aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/_vec.rs')
-rw-r--r--src/lib/_vec.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
index c0555bf1..849e750a 100644
--- a/src/lib/_vec.rs
+++ b/src/lib/_vec.rs
@@ -5,12 +5,15 @@ native "rust" mod rustrt {
type vbuf;
fn vec_buf[T](vec[T] v) -> vbuf;
fn vec_len[T](vec[T] v) -> uint;
- fn vec_alloc[T](uint n_elts) -> vec[T];
+ /* The T in vec_alloc[T, U] is the type of the vec to allocate. The
+ * U is the type of an element in the vec. So to allocate a vec[U] we
+ * want to invoke this as vec_alloc[vec[U], U]. */
+ fn vec_alloc[T, U](uint n_elts) -> vec[U];
fn refcount[T](vec[T] v) -> uint;
}
fn alloc[T](uint n_elts) -> vec[T] {
- ret rustrt.vec_alloc[T](n_elts);
+ ret rustrt.vec_alloc[vec[T], T](n_elts);
}
type init_op[T] = fn(uint i) -> T;