Skip to content

Commit d5fd811

Browse files
committed
Pass parametric types by-alias in various stdlib spots.
1 parent 085790a commit d5fd811

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/lib/_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn init_elt[T](&T t, uint n_elts) -> vec[T] {
3232
/**
3333
* FIXME (issue #81): should be:
3434
*
35-
* fn elt_op[T](T x, uint i) -> T { ret x; }
35+
* fn elt_op[T](&T x, uint i) -> T { ret x; }
3636
* let init_op[T] inner = bind elt_op[T](t, _);
3737
* ret init_fn[T](inner, n_elts);
3838
*/
@@ -70,7 +70,7 @@ fn slice[T](vec[T] v, int start, int end) -> vec[T] {
7070

7171
// Ought to take mutable &vec[T] v and just mutate it instead of copy
7272
// and return. Blocking on issue #89 for this.
73-
fn grow[T](mutable vec[T] v, int n, T initval) -> vec[T] {
73+
fn grow[T](mutable vec[T] v, int n, &T initval) -> vec[T] {
7474
let int i = n;
7575
while (i > 0) {
7676
i -= 1;

src/lib/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import std.util;
99
import std._vec;
1010

1111

12-
type hashfn[K] = fn(K) -> uint;
13-
type eqfn[K] = fn(K) -> bool;
12+
type hashfn[K] = fn(&K) -> uint;
13+
type eqfn[K] = fn(&K) -> bool;
1414

1515
type hashmap[K, V] = obj {
1616
fn insert(&K key, &V val);

src/lib/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn option_map[T, U](&operator[T, U] f, &option[T] opt) -> option[U] {
1313
}
1414
}
1515

16-
fn id[T](T x) -> T {
16+
fn id[T](&T x) -> T {
1717
ret x;
1818
}
1919

0 commit comments

Comments
 (0)