about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-07-12 21:05:59 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-07-17 14:57:55 -0700
commitdc4bf173f824da0fc8c6813191e3b61e871117ba (patch)
tree3751e1c23acb336eb302432ea836b8e7ae1fe500
parent88fe4ae09c2240fcb10fef98a0f5a61559849902 (diff)
downloadrust-dc4bf173f824da0fc8c6813191e3b61e871117ba.tar.gz
rust-dc4bf173f824da0fc8c6813191e3b61e871117ba.zip
test: Fix tests.
-rw-r--r--src/compiletest/compiletest.rs20
-rw-r--r--src/compiletest/runtest.rs2
-rw-r--r--src/libextra/num/bigint.rs5
-rw-r--r--src/libextra/ringbuf.rs30
-rw-r--r--src/libextra/sort.rs1
-rw-r--r--src/libstd/rt/uv/net.rs6
-rw-r--r--src/libstd/vec.rs2
-rw-r--r--src/test/bench/graph500-bfs.rs4
-rw-r--r--src/test/compile-fail/closure-bounds-cant-mutably-borrow-with-copy.rs44
-rw-r--r--src/test/compile-fail/kindck-owned.rs10
-rw-r--r--src/test/compile-fail/once-cant-copy-stack-once-fn-copy.rs20
-rw-r--r--src/test/run-pass/closure-bounds-recursive-stack-closure.rs31
-rwxr-xr-xsrc/test/run-pass/generic-static-methods.rs4
-rw-r--r--src/test/run-pass/match-drop-strs-issue-4541.rs2
-rw-r--r--src/test/run-pass/reflect-visit-type.rs2
15 files changed, 30 insertions, 153 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 012db7409a4..dbd05e9d591 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -40,17 +40,6 @@ pub mod runtest;
 pub mod common;
 pub mod errors;
 
-<<<<<<< HEAD
-=======
-mod std {
-    pub use core::clone;
-    pub use core::cmp;
-    pub use core::str;
-    pub use core::sys;
-    pub use core::unstable;
-}
-
->>>>>>> test: Fix tests.
 pub fn main() {
     let args = os::args();
     let config = parse_config(args);
@@ -91,7 +80,7 @@ pub fn parse_config(args: ~[~str]) -> config {
          ];
 
     assert!(!args.is_empty());
-    let argv0 = copy args[0];
+    let argv0 = args[0].clone();
     let args_ = args.tail();
     if args[1] == ~"-h" || args[1] == ~"--help" {
         let message = fmt!("Usage: %s [OPTIONS] [TESTNAME...]", argv0);
@@ -128,17 +117,10 @@ pub fn parse_config(args: ~[~str]) -> config {
         mode: str_mode(getopts::opt_str(matches, "mode")),
         run_ignored: getopts::opt_present(matches, "ignored"),
         filter:
-<<<<<<< HEAD
             if !matches.free.is_empty() {
                  Some(matches.free[0].clone())
             } else {
                 None
-=======
-             if !matches.free.is_empty() {
-                option::Some(matches.free[0].clone())
-             } else {
-                option::None
->>>>>>> test: Fix tests.
             },
         logfile: getopts::opt_maybe_str(matches, "logfile").map(|s| Path(*s)),
         save_metrics: getopts::opt_maybe_str(matches, "save-metrics").map(|s| Path(*s)),
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 76e5d3e6b4e..a2f36c104a0 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -852,7 +852,7 @@ fn make_o_name(config: &config, testfile: &Path) -> Path {
 
 fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
     if suffix.len() == 0 {
-        copy *p
+        (*p).clone()
     } else {
         let stem = p.filestem().get();
         p.with_filestem(stem + "-" + suffix)
diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs
index 9404f3f4896..d940b6d6667 100644
--- a/src/libextra/num/bigint.rs
+++ b/src/libextra/num/bigint.rs
@@ -45,6 +45,8 @@ A BigDigit is half the size of machine word size.
 #[cfg(target_arch = "x86_64")]
 pub type BigDigit = u32;
 
+pub static ZERO_BIG_DIGIT: BigDigit = 0;
+
 pub mod BigDigit {
     use bigint::BigDigit;
 
@@ -614,7 +616,8 @@ impl BigUint {
     priv fn shl_unit(&self, n_unit: uint) -> BigUint {
         if n_unit == 0 || self.is_zero() { return (*self).clone(); }
 
-        return BigUint::new(vec::from_elem(n_unit, 0u32) + self.data);
+        return BigUint::new(vec::from_elem(n_unit, ZERO_BIG_DIGIT)
+                            + self.data);
     }
 
 
diff --git a/src/libextra/ringbuf.rs b/src/libextra/ringbuf.rs
index c331cdfd868..6f8ca6500c6 100644
--- a/src/libextra/ringbuf.rs
+++ b/src/libextra/ringbuf.rs
@@ -417,28 +417,28 @@ mod tests {
 
     #[cfg(test)]
     fn test_parameterized<T:Clone + Eq>(a: T, b: T, c: T, d: T) {
-        let mut deq = Deque::new();
+        let mut deq = RingBuf::new();
         assert_eq!(deq.len(), 0);
-        deq.add_front(a.clone());
-        deq.add_front(b.clone());
-        deq.add_back(c.clone());
+        deq.push_front(a.clone());
+        deq.push_front(b.clone());
+        deq.push_back(c.clone());
         assert_eq!(deq.len(), 3);
-        deq.add_back(d.clone());
+        deq.push_back(d.clone());
         assert_eq!(deq.len(), 4);
-        assert_eq!((*deq.peek_front()).clone(), b.clone());
-        assert_eq!((*deq.peek_back()).clone(), d.clone());
-        assert_eq!(deq.pop_front(), b.clone());
-        assert_eq!(deq.pop_back(), d.clone());
-        assert_eq!(deq.pop_back(), c.clone());
-        assert_eq!(deq.pop_back(), a.clone());
+        assert_eq!((*deq.front().get()).clone(), b.clone());
+        assert_eq!((*deq.back().get()).clone(), d.clone());
+        assert_eq!(deq.pop_front().get(), b.clone());
+        assert_eq!(deq.pop_back().get(), d.clone());
+        assert_eq!(deq.pop_back().get(), c.clone());
+        assert_eq!(deq.pop_back().get(), a.clone());
         assert_eq!(deq.len(), 0);
-        deq.add_back(c.clone());
+        deq.push_back(c.clone());
         assert_eq!(deq.len(), 1);
-        deq.add_front(b.clone());
+        deq.push_front(b.clone());
         assert_eq!(deq.len(), 2);
-        deq.add_back(d.clone());
+        deq.push_back(d.clone());
         assert_eq!(deq.len(), 3);
-        deq.add_front(a.clone());
+        deq.push_front(a.clone());
         assert_eq!(deq.len(), 4);
         assert_eq!((*deq.get(0)).clone(), a.clone());
         assert_eq!((*deq.get(1)).clone(), b.clone());
diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs
index a1cd2dfb240..4269447c7ea 100644
--- a/src/libextra/sort.rs
+++ b/src/libextra/sort.rs
@@ -1021,6 +1021,7 @@ mod big_tests {
 
     use sort::*;
 
+    use std::cast::unsafe_copy;
     use std::local_data;
     use std::rand::RngUtil;
     use std::rand;
diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs
index ec6e909219d..b9713fffb65 100644
--- a/src/libstd/rt/uv/net.rs
+++ b/src/libstd/rt/uv/net.rs
@@ -663,7 +663,7 @@ mod test {
                 let server_stream_watcher = server_stream_watcher;
                 rtdebug!("starting read");
                 let alloc: AllocCallback = |size| {
-                    vec_to_uv_buf(vec::from_elem(size, 0))
+                    vec_to_uv_buf(vec::from_elem(size, 0u8))
                 };
                 do client_tcp_watcher.read_start(alloc) |stream_watcher, nread, buf, status| {
 
@@ -803,7 +803,7 @@ mod test {
 
             rtdebug!("starting read");
             let alloc: AllocCallback = |size| {
-                vec_to_uv_buf(vec::from_elem(size, 0))
+                vec_to_uv_buf(vec::from_elem(size, 0u8))
             };
 
             do server.recv_start(alloc) |server, nread, buf, src, flags, status| {
@@ -862,7 +862,7 @@ mod test {
 
             rtdebug!("starting read");
             let alloc: AllocCallback = |size| {
-                vec_to_uv_buf(vec::from_elem(size, 0))
+                vec_to_uv_buf(vec::from_elem(size, 0u8))
             };
 
             do server.recv_start(alloc) |server, nread, buf, src, flags, status| {
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index e380cc36b32..085510171ee 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -3468,7 +3468,7 @@ mod tests {
         assert_eq!(values, [2, 3, 5, 6, 7]);
     }
 
-    #[deriving(Eq)]
+    #[deriving(Clone, Eq)]
     struct Foo;
 
     #[test]
diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs
index 6280fca1cc6..a6888460a3f 100644
--- a/src/test/bench/graph500-bfs.rs
+++ b/src/test/bench/graph500-bfs.rs
@@ -199,11 +199,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
               white => {
                 let i = i as node_id;
 
-<<<<<<< HEAD
                 let neighbors = &graph[i];
-=======
-                let neighbors = graph[i].clone();
->>>>>>> librustc: Remove all uses of "copy".
 
                 let mut color = white;
 
diff --git a/src/test/compile-fail/closure-bounds-cant-mutably-borrow-with-copy.rs b/src/test/compile-fail/closure-bounds-cant-mutably-borrow-with-copy.rs
deleted file mode 100644
index bfb1e910495..00000000000
--- a/src/test/compile-fail/closure-bounds-cant-mutably-borrow-with-copy.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2013 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.
-
-// Tests correct kind-checking of the reason stack closures without the :Copy
-// bound must be noncopyable. For details see
-// http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/
-
-struct R<'self> {
-    // This struct is needed to create the
-    // otherwise infinite type of a fn that
-    // accepts itself as argument:
-    c: &'self fn:Copy(&R, bool)
-}
-
-fn innocent_looking_victim() {
-    let mut x = Some(~"hello");
-    do conspirator |f, writer| {
-        if writer {
-            x = None; //~ ERROR cannot implicitly borrow
-        } else {
-            match x {
-                Some(ref msg) => {
-                    (f.c)(f, true);
-                    println(fmt!("%?", msg));
-                },
-                None => fail!("oops"),
-            }
-        }
-    }
-}
-
-fn conspirator(f: &fn:Copy(&R, bool)) {
-    let r = R {c: f};
-    f(&r, false)
-}
-
-fn main() { innocent_looking_victim() }
diff --git a/src/test/compile-fail/kindck-owned.rs b/src/test/compile-fail/kindck-owned.rs
index ed21df4a691..c3c929a2288 100644
--- a/src/test/compile-fail/kindck-owned.rs
+++ b/src/test/compile-fail/kindck-owned.rs
@@ -24,14 +24,4 @@ fn main() {
 
     copy2(@3);
     copy2(@&x); //~ ERROR does not fulfill `'static`
-<<<<<<< HEAD
-
-    let boxed: @fn() = || {};
-    copy2(boxed);
-    let owned: ~fn() = || {};
-    copy2(owned);    //~ ERROR does not fulfill `Copy`
-    let borrowed: &fn:Copy() = || {};
-    copy2(borrowed); //~ ERROR does not fulfill `'static`
-=======
->>>>>>> librustc: Remove all uses of "copy".
 }
diff --git a/src/test/compile-fail/once-cant-copy-stack-once-fn-copy.rs b/src/test/compile-fail/once-cant-copy-stack-once-fn-copy.rs
deleted file mode 100644
index 6f524c0068b..00000000000
--- a/src/test/compile-fail/once-cant-copy-stack-once-fn-copy.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2013 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.
-
-// Though it should be legal to copy a heap-allocated "once fn:Copy",
-// stack closures are not deep-copied, so (counterintuitively) it should be
-// illegal to copy them.
-
-fn foo<'r>(blk: &'r once fn:Copy()) -> (&'r once fn:Copy(), &'r once fn:Copy()) {
-    (copy blk, blk) //~ ERROR copying a value of non-copyable type
-}
-
-fn main() {
-}
diff --git a/src/test/run-pass/closure-bounds-recursive-stack-closure.rs b/src/test/run-pass/closure-bounds-recursive-stack-closure.rs
deleted file mode 100644
index 8bb57ebaaf5..00000000000
--- a/src/test/run-pass/closure-bounds-recursive-stack-closure.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2013 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.
-
-// Ensures that it's legal to create a recursive stack closure as long as
-// its environment is copyable
-
-struct R<'self> {
-    // This struct is needed to create the
-    // otherwise infinite type of a fn that
-    // accepts itself as argument:
-    c: &'self fn:Copy(&R, uint) -> uint
-}
-
-fn main() {
-    // Stupid version of fibonacci.
-    let fib: &fn:Copy(&R, uint) -> uint = |fib, x| {
-        if x == 0 || x == 1 {
-            x
-        } else {
-            (fib.c)(fib, x-1) + (fib.c)(fib, x-2)
-        }
-    };
-    assert!(fib(&R { c: fib }, 7) == 13);
-}
diff --git a/src/test/run-pass/generic-static-methods.rs b/src/test/run-pass/generic-static-methods.rs
index a4e592872a7..532f4bc7ffb 100755
--- a/src/test/run-pass/generic-static-methods.rs
+++ b/src/test/run-pass/generic-static-methods.rs
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 trait vec_utils<T> {
-    fn map_<U:Copy>(x: &Self, f: &fn(&T) -> U) -> ~[U];
+    fn map_<U>(x: &Self, f: &fn(&T) -> U) -> ~[U];
 }
 
 impl<T> vec_utils<T> for ~[T] {
-    fn map_<U:Copy>(x: &~[T], f: &fn(&T) -> U) -> ~[U] {
+    fn map_<U>(x: &~[T], f: &fn(&T) -> U) -> ~[U] {
         let mut r = ~[];
         for x.iter().advance |elt| {
             r.push(f(elt));
diff --git a/src/test/run-pass/match-drop-strs-issue-4541.rs b/src/test/run-pass/match-drop-strs-issue-4541.rs
index 2a629b62534..92095335fc4 100644
--- a/src/test/run-pass/match-drop-strs-issue-4541.rs
+++ b/src/test/run-pass/match-drop-strs-issue-4541.rs
@@ -10,7 +10,7 @@ fn parse_args() -> ~str {
     let mut n = 0;
 
     while n < args.len() {
-        match copy args[n] {
+        match args[n].clone() {
             ~"-v" => (),
             s => {
                 return s;
diff --git a/src/test/run-pass/reflect-visit-type.rs b/src/test/run-pass/reflect-visit-type.rs
index e0d9165fe99..d1d8ab7e40b 100644
--- a/src/test/run-pass/reflect-visit-type.rs
+++ b/src/test/run-pass/reflect-visit-type.rs
@@ -172,7 +172,7 @@ pub fn main() {
     visit_ty::<~[int]>(vv);
 
     for v.types.iter().advance |s| {
-        println(fmt!("type: %s", copy *s));
+        println(fmt!("type: %s", (*s).clone()));
     }
     assert_eq!((*v.types).clone(), ~[~"bool", ~"int", ~"i8", ~"i16", ~"[", ~"int", ~"]"]);
 }