about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-08 08:45:43 -0800
committerbors <bors@rust-lang.org>2013-03-08 08:45:43 -0800
commit3bbcac322669cff3abde5be937cc4ec3860f3985 (patch)
tree70dd00fbb69807cc2dcab84b9ad5803fe06e57bf /src/test
parent647a94d01a54a75e08fd1b6fa74761f70874bafe (diff)
parent62651df2b482af4dc98b0aec6c5f1ad112fab8ec (diff)
downloadrust-3bbcac322669cff3abde5be937cc4ec3860f3985.tar.gz
rust-3bbcac322669cff3abde5be937cc4ec3860f3985.zip
auto merge of #5279 : alexcrichton/rust/no-dvec, r=pcwalton
Closes #4985 by removing the `dvec` module and all use cases throughout the compiler.

A number of uses were directly convertible to `let mut foo = ~[];`, while others in hash maps and some fields had to be converted to `@mut ~[T]`. A small number of `DVec` instances in fields were able to be converted directly to `~[T]` without the `@`, but this was a difficult thing to do.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/cci_nested_lib.rs8
-rw-r--r--src/test/auxiliary/issue-2631-a.rs3
-rw-r--r--src/test/bench/core-vec-append.rs76
-rw-r--r--src/test/compile-fail/issue-2590.rs6
-rw-r--r--src/test/run-pass/call-closure-from-overloaded-op.rs2
-rw-r--r--src/test/run-pass/dvec-index-op.rs16
-rw-r--r--src/test/run-pass/dvec-test.rs36
-rw-r--r--src/test/run-pass/issue-2631-b.rs3
8 files changed, 8 insertions, 142 deletions
diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs
index a818ff58f94..ab9dc29441a 100644
--- a/src/test/auxiliary/cci_nested_lib.rs
+++ b/src/test/auxiliary/cci_nested_lib.rs
@@ -10,11 +10,9 @@
 
 #[legacy_modes];
 
-use core::dvec::DVec;
-
 pub struct Entry<A,B> {key: A, value: B}
 
-pub struct alist<A,B> { eq_fn: @fn(A,A) -> bool, data: DVec<Entry<A,B>> }
+pub struct alist<A,B> { eq_fn: @fn(A,A) -> bool, data: @mut ~[Entry<A,B>] }
 
 pub fn alist_add<A:Copy,B:Copy>(lst: alist<A,B>, k: A, v: B) {
     lst.data.push(Entry{key:k, value:v});
@@ -31,12 +29,12 @@ pub fn alist_get<A:Copy,B:Copy>(lst: alist<A,B>, k: A) -> B {
 #[inline]
 pub fn new_int_alist<B:Copy>() -> alist<int, B> {
     fn eq_int(&&a: int, &&b: int) -> bool { a == b }
-    return alist {eq_fn: eq_int, data: DVec()};
+    return alist {eq_fn: eq_int, data: @mut ~[]};
 }
 
 #[inline]
 pub fn new_int_alist_2<B:Copy>() -> alist<int, B> {
     #[inline]
     fn eq_int(&&a: int, &&b: int) -> bool { a == b }
-    return alist {eq_fn: eq_int, data: DVec()};
+    return alist {eq_fn: eq_int, data: @mut ~[]};
 }
diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs
index b1fb7a82c5c..f7788c7d57a 100644
--- a/src/test/auxiliary/issue-2631-a.rs
+++ b/src/test/auxiliary/issue-2631-a.rs
@@ -13,10 +13,9 @@
 
 extern mod std;
 
-use core::dvec::*;
 use std::oldmap::HashMap;
 
-pub type header_map = HashMap<~str, @DVec<@~str>>;
+pub type header_map = HashMap<~str, @mut ~[@~str]>;
 
 // the unused ty param is necessary so this gets monomorphized
 pub fn request<T:Copy>(req: header_map) {
diff --git a/src/test/bench/core-vec-append.rs b/src/test/bench/core-vec-append.rs
deleted file mode 100644
index 4117add8926..00000000000
--- a/src/test/bench/core-vec-append.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// A raw test of vector appending performance.
-
-extern mod std;
-use core::dvec::DVec;
-use core::io::WriterUtil;
-
-fn collect_raw(num: uint) -> ~[uint] {
-    let mut result = ~[];
-    for uint::range(0u, num) |i| {
-        result.push(i);
-    }
-    return result;
-}
-
-fn collect_dvec(num: uint) -> ~[uint] {
-    let result = DVec();
-    for uint::range(0u, num) |i| {
-        result.push(i);
-    }
-    return dvec::unwrap(result);
-}
-
-fn main() {
-    let args = os::args();
-    let args = if os::getenv(~"RUST_BENCH").is_some() {
-        ~[~"", ~"50000000"]
-    } else if args.len() <= 1u {
-        ~[~"", ~"100000"]
-    } else {
-        args
-    };
-    let max = uint::from_str(args[1]).get();
-    let start = std::time::precise_time_s();
-    let raw_v = collect_raw(max);
-    let mid = std::time::precise_time_s();
-    let dvec_v = collect_dvec(max);
-    let end = std::time::precise_time_s();
-
-    // check each vector
-    fail_unless!(raw_v.len() == max);
-    for raw_v.eachi |i, v| { fail_unless!(i == *v); }
-    fail_unless!(dvec_v.len() == max);
-    for dvec_v.eachi |i, v| { fail_unless!(i == *v); }
-
-    let raw = mid - start;
-    let dvec = end - mid;
-
-    let maxf = max as float;
-    let rawf = raw as float;
-    let dvecf = dvec as float;
-    
-    io::stdout().write_str(fmt!("Raw     : %? seconds\n", raw));
-    io::stdout().write_str(fmt!("        : %f op/sec\n", maxf/rawf));
-    io::stdout().write_str(fmt!("\n"));
-    io::stdout().write_str(fmt!("Dvec    : %? seconds\n", dvec));
-    io::stdout().write_str(fmt!("        : %f op/sec\n", maxf/dvecf));
-    io::stdout().write_str(fmt!("\n"));
-    
-    if dvec < raw {
-        io::stdout().write_str(fmt!("Dvec is %f%% faster than raw\n",
-                                    (rawf - dvecf) / rawf * 100.0));
-    } else {
-        io::stdout().write_str(fmt!("Raw is %f%% faster than dvec\n",
-                                    (dvecf - rawf) / dvecf * 100.0));
-    }
-}
diff --git a/src/test/compile-fail/issue-2590.rs b/src/test/compile-fail/issue-2590.rs
index 1de311f4de5..5f26adfcdc7 100644
--- a/src/test/compile-fail/issue-2590.rs
+++ b/src/test/compile-fail/issue-2590.rs
@@ -8,10 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::dvec::DVec;
-
 struct parser {
-    tokens: DVec<int>,
+    tokens: ~[int],
 }
 
 trait parse {
@@ -20,7 +18,7 @@ trait parse {
 
 impl parse for parser {
     fn parse() -> ~[int] {
-        ::core::dvec::unwrap(self.tokens) //~ ERROR moving out of immutable field
+        self.tokens //~ ERROR moving out of immutable field
     }
 }
 
diff --git a/src/test/run-pass/call-closure-from-overloaded-op.rs b/src/test/run-pass/call-closure-from-overloaded-op.rs
index 9d2c6f23198..39864059fcd 100644
--- a/src/test/run-pass/call-closure-from-overloaded-op.rs
+++ b/src/test/run-pass/call-closure-from-overloaded-op.rs
@@ -11,7 +11,7 @@
 fn foo() -> int { 22 }
 
 pub fn main() {
-    let x = dvec::DVec::<@fn() -> int>();
+    let mut x: ~[@fn() -> int] = ~[];
     x.push(foo);
     fail_unless!((x[0])() == 22);
 }
diff --git a/src/test/run-pass/dvec-index-op.rs b/src/test/run-pass/dvec-index-op.rs
deleted file mode 100644
index e061464c7b2..00000000000
--- a/src/test/run-pass/dvec-index-op.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn main() {
-    let x = dvec::DVec();
-    x.push(1);
-    io::println(fmt!("%d", x[0]));
-}
-
diff --git a/src/test/run-pass/dvec-test.rs b/src/test/run-pass/dvec-test.rs
deleted file mode 100644
index dff37af9a59..00000000000
--- a/src/test/run-pass/dvec-test.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn main() {
-    let d = dvec::DVec();
-    d.push(3);
-    d.push(4);
-    fail_unless!(d.get() == ~[3, 4]);
-    d.set(~[5]);
-    d.push(6);
-    d.push(7);
-    d.push(8);
-    d.push(9);
-    d.push(10);
-    d.push_all(~[11, 12, 13]);
-    d.push_slice(~[11, 12, 13], 1u, 2u);
-
-    let exp = ~[5, 6, 7, 8, 9, 10, 11, 12, 13, 12];
-    fail_unless!(d.get() == exp);
-    fail_unless!(d.get() == exp);
-    fail_unless!(d.len() == exp.len());
-
-    for d.eachi |i, e| {
-        fail_unless!(*e == exp[i]);
-    }
-
-    let v = dvec::unwrap(d);
-    fail_unless!(v == exp);
-}
diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs
index 79c884f869f..5f5e2f9fc30 100644
--- a/src/test/run-pass/issue-2631-b.rs
+++ b/src/test/run-pass/issue-2631-b.rs
@@ -15,12 +15,11 @@ extern mod req;
 extern mod std;
 
 use req::*;
-use std::oldmap::*;
 use std::oldmap::HashMap;
 
 pub fn main() {
   let v = ~[@~"hi"];
   let m: req::header_map = HashMap();
-  m.insert(~"METHOD", @dvec::from_vec(v));
+  m.insert(~"METHOD", @mut v);
   request::<int>(m);
 }