]> git.lizzy.rs Git - rust.git/blobdiff - src/libarena/lib.rs
test: Make manual changes to deal with the fallout from removal of
[rust.git] / src / libarena / lib.rs
index dbebb8fb2bc680edd1ec61b4ac64a7b69a8967c0..a09d5a826bb99cbb630892f3d22ac62aed5c67be 100644 (file)
 use std::rt::global_heap;
 use std::intrinsics::{TyDesc, get_tydesc};
 use std::intrinsics;
-use std::slice;
 
 // The way arena uses arrays is really deeply awful. The arrays are
 // allocated, and have capacities reserved, but the fill for the array
 // will always stay at 0.
 #[deriving(Clone, Eq)]
 struct Chunk {
-    data: Rc<RefCell<~[u8]>>,
+    data: Rc<RefCell<Vec<u8> >>,
     fill: Cell<uint>,
     is_pod: Cell<bool>,
 }
@@ -111,7 +110,7 @@ pub fn new_with_size(initial_size: uint) -> Arena {
 
 fn chunk(size: uint, is_pod: bool) -> Chunk {
     Chunk {
-        data: Rc::new(RefCell::new(slice::with_capacity(size))),
+        data: Rc::new(RefCell::new(Vec::with_capacity(size))),
         fill: Cell::new(0u),
         is_pod: Cell::new(is_pod),
     }
@@ -489,6 +488,9 @@ fn drop(&mut self) {
 #[cfg(test)]
 mod tests {
     extern crate test;
+
+    use std::vec_ng::Vec;
+
     use self::test::BenchHarness;
     use super::{Arena, TypedArena};
 
@@ -549,7 +551,7 @@ pub fn bench_pod_old_arena(bh: &mut BenchHarness) {
 
     struct Nonpod {
         string: ~str,
-        array: ~[int],
+        array: Vec<int> ,
     }
 
     #[test]
@@ -558,7 +560,7 @@ pub fn test_nonpod() {
         for _ in range(0, 100000) {
             arena.alloc(Nonpod {
                 string: ~"hello world",
-                array: ~[ 1, 2, 3, 4, 5 ],
+                array: vec!( 1, 2, 3, 4, 5 ),
             });
         }
     }
@@ -569,7 +571,7 @@ pub fn bench_nonpod(bh: &mut BenchHarness) {
         bh.iter(|| {
             arena.alloc(Nonpod {
                 string: ~"hello world",
-                array: ~[ 1, 2, 3, 4, 5 ],
+                array: vec!( 1, 2, 3, 4, 5 ),
             })
         })
     }
@@ -579,7 +581,7 @@ pub fn bench_nonpod_nonarena(bh: &mut BenchHarness) {
         bh.iter(|| {
             ~Nonpod {
                 string: ~"hello world",
-                array: ~[ 1, 2, 3, 4, 5 ],
+                array: vec!( 1, 2, 3, 4, 5 ),
             }
         })
     }
@@ -590,7 +592,7 @@ pub fn bench_nonpod_old_arena(bh: &mut BenchHarness) {
         bh.iter(|| {
             arena.alloc(|| Nonpod {
                 string: ~"hello world",
-                array: ~[ 1, 2, 3, 4, 5 ],
+                array: vec!( 1, 2, 3, 4, 5 ),
             })
         })
     }