From af3d0d1848116f0e29dcaf8859d27fd4555f3444 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 24 Mar 2011 17:21:09 -0700 Subject: rustc: Open "use"d crates; add a _vec.vec_from_buf() method along the way; XFAIL use-import-export.rs in rustc --- src/lib/_vec.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/_vec.rs') diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs index 36b529cc..c3fc7035 100644 --- a/src/lib/_vec.rs +++ b/src/lib/_vec.rs @@ -1,7 +1,7 @@ import option.none; import option.some; -import vbuf = rustrt.vbuf; +type vbuf = rustrt.vbuf; type operator2[T,U,V] = fn(&T, &U) -> V; @@ -28,6 +28,8 @@ native "rust" mod rustrt { fn refcount[T](vec[T] v) -> uint; fn vec_print_debug_info[T](vec[T] v); + + fn vec_from_vbuf[T](vbuf v, uint n_elts) -> vec[T]; } fn alloc[T](uint n_elts) -> vec[T] { @@ -48,6 +50,10 @@ fn refcount[T](vec[mutable? T] v) -> uint { } } +unsafe fn vec_from_vbuf[T](vbuf v, uint n_elts) -> vec[T] { + ret rustrt.vec_from_vbuf[T](v, n_elts); +} + type init_op[T] = fn(uint i) -> T; fn init_fn[T](&init_op[T] op, uint n_elts) -> vec[T] { -- cgit v1.2.3