diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-07-11 12:05:17 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-07-17 14:57:54 -0700 |
| commit | 2dbb3c3887ff23c064aa762eb4dafaf4967c6416 (patch) | |
| tree | 6d143b2480375aa7a5e56a22a37e29e215a51af3 /src | |
| parent | e20549ff192edec9d625f1119bcb077c3abaf070 (diff) | |
| download | rust-2dbb3c3887ff23c064aa762eb4dafaf4967c6416.tar.gz rust-2dbb3c3887ff23c064aa762eb4dafaf4967c6416.zip | |
test: Fix tests.
Diffstat (limited to 'src')
34 files changed, 109 insertions, 84 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index 4add16fd7a9..bc5741de2b9 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq)] +#[deriving(Clone, Eq)] pub enum mode { mode_compile_fail, mode_run_fail, @@ -18,6 +18,7 @@ pub enum mode { mode_codegen } +#[deriving(Clone)] pub struct config { // The library paths required for running the compiler compile_lib_path: ~str, diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 76e3f2f32ee..012db7409a4 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -40,6 +40,17 @@ 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); @@ -117,10 +128,17 @@ 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/errors.rs b/src/compiletest/errors.rs index 780a917c019..b044f19dcd6 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -15,7 +15,7 @@ pub struct ExpectedError { line: uint, kind: ~str, msg: ~str } // Load any test directives embedded in the file pub fn load_errors(testfile: &Path) -> ~[ExpectedError] { let mut error_patterns = ~[]; - let rdr = io::file_reader(testfile).get(); + let rdr = io::file_reader(testfile).unwrap(); let mut line_num = 1u; while !rdr.eof() { let ln = rdr.read_line(); diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 9cd489f0576..0860219e1a9 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -101,7 +101,7 @@ pub fn is_test_ignored(config: &config, testfile: &Path) -> bool { } fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool { - let rdr = io::file_reader(testfile).get(); + let rdr = io::file_reader(testfile).unwrap(); while !rdr.eof() { let ln = rdr.read_line(); diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index f071c204810..76e5d3e6b4e 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -672,7 +672,7 @@ fn dump_output_file(config: &config, testfile: &Path, out: &str, extension: &str) { let outfile = make_out_name(config, testfile, extension); let writer = - io::file_writer(&outfile, [io::Create, io::Truncate]).get(); + io::file_writer(&outfile, [io::Create, io::Truncate]).unwrap(); writer.write_str(out); } diff --git a/src/libextra/bitv.rs b/src/libextra/bitv.rs index f3f0f42125d..106b7c80f18 100644 --- a/src/libextra/bitv.rs +++ b/src/libextra/bitv.rs @@ -1453,7 +1453,7 @@ mod tests { fn bench_big_bitv_big(b: &mut BenchHarness) { let mut r = rng(); let mut storage = ~[]; - storage.grow(BENCH_BITS / uint::bits, &0); + storage.grow(BENCH_BITS / uint::bits, &0u); let mut bitv = BigBitv::new(storage); do b.iter { bitv.set((r.next() as uint) % BENCH_BITS, true); diff --git a/src/libextra/crypto/sha1.rs b/src/libextra/crypto/sha1.rs index 0f2d44f57e3..83cef9972d7 100644 --- a/src/libextra/crypto/sha1.rs +++ b/src/libextra/crypto/sha1.rs @@ -244,14 +244,15 @@ mod tests { use digest::{Digest, DigestUtil}; use sha1::Sha1; + #[deriving(Clone)] + struct Test { + input: ~str, + output: ~[u8], + output_str: ~str, + } + #[test] fn test() { - struct Test { - input: ~str, - output: ~[u8], - output_str: ~str, - } - fn a_million_letter_a() -> ~str { let mut i = 0; let mut rs = ~""; diff --git a/src/libextra/fileinput.rs b/src/libextra/fileinput.rs index cc87809ad5b..f7c54634fe4 100644 --- a/src/libextra/fileinput.rs +++ b/src/libextra/fileinput.rs @@ -417,7 +417,7 @@ mod test { use std::vec; fn make_file(path : &Path, contents: &[~str]) { - let file = io::file_writer(path, [io::Create, io::Truncate]).get(); + let file = io::file_writer(path, [io::Create, io::Truncate]).unwrap(); for contents.iter().advance |str| { file.write_str(*str); @@ -562,9 +562,11 @@ mod test { let f2 = Some(Path("tmp/lib-fileinput-test-no-trailing-newline-2.tmp")); - let wr = io::file_writer(f1.get_ref(), [io::Create, io::Truncate]).get(); + let wr = io::file_writer(f1.get_ref(), + [io::Create, io::Truncate]).unwrap(); wr.write_str("1\n2"); - let wr = io::file_writer(f2.get_ref(), [io::Create, io::Truncate]).get(); + let wr = io::file_writer(f2.get_ref(), + [io::Create, io::Truncate]).unwrap(); wr.write_str("3\n4"); let mut lines = ~[]; diff --git a/src/libextra/list.rs b/src/libextra/list.rs index 87d0c05aec1..03481760579 100644 --- a/src/libextra/list.rs +++ b/src/libextra/list.rs @@ -12,7 +12,7 @@ -#[deriving(Eq)] +#[deriving(Clone, Eq)] pub enum List<T> { Cons(T, @List<T>), Nil, diff --git a/src/libextra/net/ip.rs b/src/libextra/net/ip.rs index 4c3fefc6eed..c1633ffa041 100644 --- a/src/libextra/net/ip.rs +++ b/src/libextra/net/ip.rs @@ -38,6 +38,7 @@ use get_data_for_req = uv_ll::get_data_for_req; use ll = uv_ll; /// An IP address +#[deriving(Clone)] pub enum IpAddr { /// An IPv4 address Ipv4(sockaddr_in), diff --git a/src/libextra/net/tcp.rs b/src/libextra/net/tcp.rs index eebb8490aa2..122d4b85628 100644 --- a/src/libextra/net/tcp.rs +++ b/src/libextra/net/tcp.rs @@ -93,6 +93,7 @@ pub struct TcpErrData { } /// Details returned as part of a `Result::Err` result from `tcp::listen` +#[deriving(Clone)] pub enum TcpListenErrData { /** * Some unplanned-for error. The first and second fields correspond @@ -120,6 +121,7 @@ pub enum TcpListenErrData { AccessDenied } /// Details returned as part of a `Result::Err` result from `tcp::connect` +#[deriving(Clone)] pub enum TcpConnectErrData { /** * Some unplanned-for error. The first and second fields correspond diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs index dc274dfb814..d07b645a541 100644 --- a/src/libextra/priority_queue.rs +++ b/src/libextra/priority_queue.rs @@ -12,13 +12,14 @@ #[allow(missing_doc)]; - +use std::clone::Clone; use std::unstable::intrinsics::{move_val_init, init}; use std::util::{replace, swap}; use std::vec; use std::iterator::FromIterator; /// A priority queue implemented with a binary heap +#[deriving(Clone)] pub struct PriorityQueue<T> { priv data: ~[T], } diff --git a/src/libextra/sort.rs b/src/libextra/sort.rs index a11b819dda1..a1cd2dfb240 100644 --- a/src/libextra/sort.rs +++ b/src/libextra/sort.rs @@ -926,6 +926,7 @@ mod test_tim_sort { use std::rand; use std::vec; + #[deriving(Clone)] struct CVal { val: float, } @@ -992,7 +993,10 @@ mod test_tim_sort { fail!("Guarantee the fail"); } - struct DVal { val: uint } + #[deriving(Clone)] + struct DVal { + val: uint, + } impl Ord for DVal { fn lt(&self, _x: &DVal) -> bool { true } diff --git a/src/libextra/test.rs b/src/libextra/test.rs index b45e1d6323b..0a1811968f0 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -1245,7 +1245,7 @@ mod tests { ignore: false, should_fail: false }, - testfn: DynTestFn(testfn.clone()), + testfn: DynTestFn(testfn), }; tests.push(test); } diff --git a/src/libextra/uv_ll.rs b/src/libextra/uv_ll.rs index 74798d260c1..1527b090f94 100644 --- a/src/libextra/uv_ll.rs +++ b/src/libextra/uv_ll.rs @@ -266,6 +266,7 @@ pub struct uv_timer_t { } // unix size: 16 +#[deriving(Clone)] pub struct sockaddr_in { sin_family: u16, sin_port: u16, @@ -280,6 +281,7 @@ pub struct sockaddr_in6 { a0: *u8, a1: *u8, a2: *u8, a3: *u8, } + #[cfg(target_arch="x86")] #[cfg(target_arch="arm")] #[cfg(target_arch="mips")] @@ -290,6 +292,12 @@ pub struct sockaddr_in6 { a6: *u8, a7: *u8, } +impl Clone for sockaddr_in6 { + fn clone(&self) -> sockaddr_in6 { + *self + } +} + // unix size: 28 .. FIXME #1645 // stuck with 32 because of rust padding structs? pub type addr_in = addr_in_impl::addr_in; diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs index b6dabfd0b12..7c75b9c34b3 100644 --- a/src/librustpkg/tests.rs +++ b/src/librustpkg/tests.rs @@ -63,8 +63,8 @@ fn git_repo_pkg() -> PkgId { fn writeFile(file_path: &Path, contents: &str) { let out: @io::Writer = - result::get(&io::file_writer(file_path, - [io::Create, io::Truncate])); + result::unwrap(io::file_writer(file_path, + [io::Create, io::Truncate])); out.write_line(contents); } diff --git a/src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs b/src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs index ef3546efac1..ebd6f9bf9d8 100644 --- a/src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs +++ b/src/librustpkg/testsuite/pass/src/fancy-lib/pkg.rs @@ -44,7 +44,7 @@ pub fn main() { } let file = io::file_writer(&out_path.push("generated.rs"), - [io::Create]).get(); + [io::Create]).unwrap(); file.write_str("pub fn wheeeee() { for [1, 2, 3].each() |_| { assert!(true); } }"); diff --git a/src/libstd/io.rs b/src/libstd/io.rs index e074eba68ae..338f9335806 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -1856,11 +1856,11 @@ mod tests { debug!(frood.clone()); { let out: @io::Writer = - result::get( - &io::file_writer(tmpfile, [io::Create, io::Truncate])); + result::unwrap( + io::file_writer(tmpfile, [io::Create, io::Truncate])); out.write_str(frood); } - let inp: @io::Reader = result::get(&io::file_reader(tmpfile)); + let inp: @io::Reader = result::unwrap(io::file_reader(tmpfile)); let frood2: ~str = inp.read_c_str(); debug!(frood2.clone()); assert_eq!(frood, frood2); @@ -1958,10 +1958,10 @@ mod tests { fn test_read_buffer_too_small() { let path = &Path("tmp/lib-io-test-read-buffer-too-small.tmp"); // ensure the file exists - io::file_writer(path, [io::Create]).get(); + io::file_writer(path, [io::Create]).unwrap(); - let file = io::file_reader(path).get(); - let mut buf = vec::from_elem(5, 0); + let file = io::file_reader(path).unwrap(); + let mut buf = vec::from_elem(5, 0u8); file.read(buf, 6); // this should fail because buf is too small } @@ -1969,17 +1969,17 @@ mod tests { fn test_read_buffer_big_enough() { let path = &Path("tmp/lib-io-test-read-buffer-big-enough.tmp"); // ensure the file exists - io::file_writer(path, [io::Create]).get(); + io::file_writer(path, [io::Create]).unwrap(); - let file = io::file_reader(path).get(); - let mut buf = vec::from_elem(5, 0); + let file = io::file_reader(path).unwrap(); + let mut buf = vec::from_elem(5, 0u8); file.read(buf, 4); // this should succeed because buf is big enough } #[test] fn test_write_empty() { let file = io::file_writer(&Path("tmp/lib-io-test-write-empty.tmp"), - [io::Create]).get(); + [io::Create]).unwrap(); file.write([]); } @@ -2025,7 +2025,7 @@ mod tests { // write the ints to the file { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); for uints.iter().advance |i| { file.write_le_u64(*i); } @@ -2033,7 +2033,7 @@ mod tests { // then read them back and check that they are the same { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); for uints.iter().advance |i| { assert_eq!(file.read_le_u64(), *i); } @@ -2047,7 +2047,7 @@ mod tests { // write the ints to the file { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); for uints.iter().advance |i| { file.write_be_u64(*i); } @@ -2055,7 +2055,7 @@ mod tests { // then read them back and check that they are the same { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); for uints.iter().advance |i| { assert_eq!(file.read_be_u64(), *i); } @@ -2069,7 +2069,7 @@ mod tests { // write the ints to the file { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); for ints.iter().advance |i| { file.write_be_i32(*i); } @@ -2077,7 +2077,7 @@ mod tests { // then read them back and check that they are the same { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); for ints.iter().advance |i| { // this tests that the sign extension is working // (comparing the values as i32 would not test this) @@ -2093,12 +2093,12 @@ mod tests { let buf = ~[0x41, 0x02, 0x00, 0x00]; { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); file.write(buf); } { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); let f = file.read_be_f32(); assert_eq!(f, 8.1250); } @@ -2110,13 +2110,13 @@ mod tests { let f:f32 = 8.1250; { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); file.write_be_f32(f); file.write_le_f32(f); } { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); assert_eq!(file.read_be_f32(), 8.1250); assert_eq!(file.read_le_f32(), 8.1250); } diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs index 09c748ec047..ec6e909219d 100644 --- a/src/libstd/rt/uv/net.rs +++ b/src/libstd/rt/uv/net.rs @@ -736,7 +736,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| { diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index 0c82df7e43a..b655dc828bf 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -178,7 +178,6 @@ impl<A:ToStr> ToStr for @[A] { } #[cfg(test)] -#[allow(non_implicitly_copyable_typarams)] mod tests { use hashmap::HashMap; use hashmap::HashSet; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index c9c5217ca61..e380cc36b32 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -3049,7 +3049,6 @@ mod tests { #[test] #[ignore(windows)] #[should_fail] - #[allow(non_implicitly_copyable_typarams)] fn test_grow_fn_fail() { let mut v = ~[]; do v.grow_fn(100) |i| { @@ -3108,7 +3107,6 @@ mod tests { #[test] #[ignore(windows)] #[should_fail] - #[allow(non_implicitly_copyable_typarams)] fn test_permute_fail() { let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; let mut i = 0; diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index d0dfb0fb06e..09fea560f37 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -835,7 +835,7 @@ mod test { // because of the SCTable, I now need a tidy way of // creating syntax objects. Sigh. - #[deriving(Eq)] + #[deriving(Clone, Eq)] enum TestSC { M(Mrk), R(ident,Name) diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 82139ca3c16..1f98865a10c 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -75,7 +75,7 @@ fn read_line() { .push_rel(&Path("src/test/bench/shootout-k-nucleotide.data")); for int::range(0, 3) |_i| { - let reader = result::get(&io::file_reader(&path)); + let reader = result::unwrap(io::file_reader(&path)); while !reader.eof() { reader.read_line(); } diff --git a/src/test/bench/graph500-bfs.rs b/src/test/bench/graph500-bfs.rs index bbdfd3ecf79..6280fca1cc6 100644 --- a/src/test/bench/graph500-bfs.rs +++ b/src/test/bench/graph500-bfs.rs @@ -154,6 +154,15 @@ fn bfs(graph: graph, key: node_id) -> bfs_result { marks } +#[deriving(Clone)] +enum color { + white, + // node_id marks which node turned this gray/black. + // the node id later becomes the parent. + gray(node_id), + black(node_id) +} + /** * Another version of the bfs function. * @@ -163,14 +172,6 @@ fn bfs(graph: graph, key: node_id) -> bfs_result { fn bfs2(graph: graph, key: node_id) -> bfs_result { // This works by doing functional updates of a color vector. - enum color { - white, - // node_id marks which node turned this gray/black. - // the node id later becomes the parent. - gray(node_id), - black(node_id) - }; - let mut colors = do vec::from_fn(graph.len()) |i| { if i as node_id == key { gray(key) @@ -236,14 +237,6 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result { fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result { // This works by doing functional updates of a color vector. - enum color { - white, - // node_id marks which node turned this gray/black. - // the node id later becomes the parent. - gray(node_id), - black(node_id) - }; - let graph_vec = graph.get(); // FIXME #3387 requires this temp let mut colors = do vec::from_fn(graph_vec.len()) |i| { if i as node_id == key { diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index f6e90d1b745..5d05817e512 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -124,8 +124,8 @@ fn main() { }; let writer = if os::getenv("RUST_BENCH").is_some() { - result::get(&io::file_writer(&Path("./shootout-fasta.data"), - [io::Truncate, io::Create])) + result::unwrap(io::file_writer(&Path("./shootout-fasta.data"), + [io::Truncate, io::Create])) } else { io::stdout() }; diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 86ab99407b9..6a09238c2f2 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -162,7 +162,7 @@ fn main() { // get to this massive data set, but include_bin! chokes on it (#2598) let path = Path(env!("CFG_SRC_DIR")) .push_rel(&Path("src/test/bench/shootout-k-nucleotide.data")); - result::get(&io::file_reader(&path)) + result::unwrap(io::file_reader(&path)) } else { io::stdin() }; diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/compile-fail/closure-bounds-subtype.rs index 324634ac66d..f04da0575b9 100644 --- a/src/test/compile-fail/closure-bounds-subtype.rs +++ b/src/test/compile-fail/closure-bounds-subtype.rs @@ -11,7 +11,7 @@ fn give_any(f: &fn:()) { fn give_owned(f: &fn:Send()) { take_any(f); - take_const_owned(f); //~ ERROR expected bounds `Freeze+Send` but found bounds `Send` + take_const_owned(f); //~ ERROR expected bounds `Send+Freeze` but found bounds `Send` } fn main() {} diff --git a/src/test/compile-fail/issue-2548.rs b/src/test/compile-fail/issue-2548.rs index 47087337e34..cb0b8afbf8b 100644 --- a/src/test/compile-fail/issue-2548.rs +++ b/src/test/compile-fail/issue-2548.rs @@ -37,7 +37,7 @@ fn main() { let mut res = foo(x); let mut v = ~[]; - v = ~[(res)] + v; //~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Clone` + v = ~[(res)] + v; //~ failed to find an implementation of trait assert_eq!(v.len(), 2); } diff --git a/src/test/compile-fail/trait-bounds-cant-coerce.rs b/src/test/compile-fail/trait-bounds-cant-coerce.rs index 72d6b70a7c2..7f8a26716cd 100644 --- a/src/test/compile-fail/trait-bounds-cant-coerce.rs +++ b/src/test/compile-fail/trait-bounds-cant-coerce.rs @@ -14,11 +14,8 @@ trait Foo { fn a(_x: ~Foo:Send) { } -fn b(_x: ~Foo:Send+Clone) { -} - fn c(x: ~Foo:Freeze+Send) { - b(x); //~ ERROR expected bounds `Clone+Send` + a(x); } fn d(x: ~Foo:) { diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index e0fc3357d7b..2d59e490e0d 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: instantiating a type parameter with an incompatible type +// error-pattern: failed to find an implementation struct r { i:int diff --git a/src/test/run-pass/issue-2989.rs b/src/test/run-pass/issue-2989.rs index c13821bddf1..5b3333fb998 100644 --- a/src/test/run-pass/issue-2989.rs +++ b/src/test/run-pass/issue-2989.rs @@ -20,7 +20,7 @@ trait methods { impl methods for () { fn to_bytes(&self) -> ~[u8] { - vec::from_elem(0, 0) + vec::from_elem(0, 0u8) } } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index ae2ae6dbf9c..d7897223d47 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -13,6 +13,7 @@ extern mod extra; use extra::list; +#[deriving(Clone)] enum foo { a(uint), b(~str), diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index 8257d495d46..f4026c83c3e 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -14,15 +14,15 @@ extern mod extra; use extra::list::*; -fn pure_length_go<T>(ls: @List<T>, acc: uint) -> uint { +fn pure_length_go<T:Clone>(ls: @List<T>, acc: uint) -> uint { match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } } } -fn pure_length<T>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } +fn pure_length<T:Clone>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } -fn nonempty_list<T>(ls: @List<T>) -> bool { pure_length(ls) > 0u } +fn nonempty_list<T:Clone>(ls: @List<T>) -> bool { pure_length(ls) > 0u } -fn safe_head<T>(ls: @List<T>) -> T { +fn safe_head<T:Clone>(ls: @List<T>) -> T { assert!(!is_empty(ls)); return head(ls); } diff --git a/src/test/run-pass/repeated-vector-syntax.rs b/src/test/run-pass/repeated-vector-syntax.rs index f3d6c1640d8..40ce248f286 100644 --- a/src/test/run-pass/repeated-vector-syntax.rs +++ b/src/test/run-pass/repeated-vector-syntax.rs @@ -8,16 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub fn main() { - struct Foo { a: ~str } +#[deriving(Clone)] +struct Foo { + a: ~str, +} - let v = [ ~Foo { a: ~"Hello!" }, ..129 ]; - let w = [ ~"Hello!", ..129 ]; +pub fn main() { let x = [ @[true], ..512 ]; let y = [ 0, ..1 ]; - error!("%?", v); - error!("%?", w); error!("%?", x); error!("%?", y); } |
