diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-03-05 15:28:08 -0800 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-21 23:37:21 +1100 |
| commit | af79a5aa7da4f42fc0939a19f46fa73b894d6e9a (patch) | |
| tree | 60c2e72eea83a8a4c70c76d6fe91967aeaf77632 /src/test/compile-fail | |
| parent | 579eb2400b3cb5d9cf03a5c8792d63630489193a (diff) | |
| download | rust-af79a5aa7da4f42fc0939a19f46fa73b894d6e9a.tar.gz rust-af79a5aa7da4f42fc0939a19f46fa73b894d6e9a.zip | |
test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
Diffstat (limited to 'src/test/compile-fail')
52 files changed, 104 insertions, 192 deletions
diff --git a/src/test/compile-fail/access-mode-in-closures.rs b/src/test/compile-fail/access-mode-in-closures.rs index e1696f0e63e..8dbf292277b 100644 --- a/src/test/compile-fail/access-mode-in-closures.rs +++ b/src/test/compile-fail/access-mode-in-closures.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; struct sty(Vec<int> ); diff --git a/src/test/compile-fail/ambig_impl_unify.rs b/src/test/compile-fail/ambig_impl_unify.rs index 7d842e3d5ab..24a4c9863f7 100644 --- a/src/test/compile-fail/ambig_impl_unify.rs +++ b/src/test/compile-fail/ambig_impl_unify.rs @@ -8,16 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + trait foo { fn foo(&self) -> int; } impl foo for Vec<uint> { - fn foo(&self) -> int {1} //~ NOTE candidate #1 is `~[uint].foo::foo` + fn foo(&self) -> int {1} //~ NOTE candidate #1 is `Vec<uint>.foo::foo` } impl foo for Vec<int> { - fn foo(&self) -> int {2} //~ NOTE candidate #2 is `~[int].foo::foo` + fn foo(&self) -> int {2} //~ NOTE candidate #2 is `Vec<int>.foo::foo` } fn main() { diff --git a/src/test/compile-fail/bad-expr-path.rs b/src/test/compile-fail/bad-expr-path.rs index 6ba5a3333c5..6e73427f80f 100644 --- a/src/test/compile-fail/bad-expr-path.rs +++ b/src/test/compile-fail/bad-expr-path.rs @@ -12,4 +12,4 @@ mod m1 {} -fn main(args: vec!(str)) { log(debug, m1::a); } +fn main(args: Vec<~str>) { log(debug, m1::a); } diff --git a/src/test/compile-fail/bad-expr-path2.rs b/src/test/compile-fail/bad-expr-path2.rs index 4c85ba07637..d2b3a578686 100644 --- a/src/test/compile-fail/bad-expr-path2.rs +++ b/src/test/compile-fail/bad-expr-path2.rs @@ -14,4 +14,6 @@ mod m1 { pub mod a {} } -fn main(args: vec!(str)) { log(debug, m1::a); } +fn main(args: Vec<~str>) { + log(debug, m1::a); +} diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs index 2377870c647..143ebdaa773 100644 --- a/src/test/compile-fail/borrowck-assign-comp-idx.rs +++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs @@ -17,9 +17,9 @@ fn a() { let mut p = vec!(1); // Create an immutable pointer into p's contents: - let q: &int = &p[0]; + let q: &int = p.get(0); - p[0] = 5; //~ ERROR cannot assign + *p.get_mut(0) = 5; //~ ERROR cannot borrow println!("{}", *q); } @@ -33,16 +33,16 @@ fn b() { let mut p = vec!(1); borrow( - p, - || p[0] = 5); //~ ERROR cannot borrow `p` as mutable + p.as_slice(), + || *p.get_mut(0) = 5); //~ ERROR cannot borrow `p` as mutable } fn c() { // Legal because the scope of the borrow does not include the // modification: let mut p = vec!(1); - borrow(p, ||{}); - p[0] = 5; + borrow(p.as_slice(), ||{}); + *p.get_mut(0) = 5; } fn main() { diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs index a9c4fa9a4b5..ef9bee80c2b 100644 --- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs @@ -28,6 +28,7 @@ fn defer<'r>(x: &'r [&'r str]) -> defer<'r> { } fn main() { - let x = defer(vec!("Goodbye", "world!")); //~ ERROR borrowed value does not live long enough + let x = defer(vec!("Goodbye", "world!").as_slice()); + //~^ ERROR borrowed value does not live long enough x.x[0]; } diff --git a/src/test/compile-fail/borrowck-init-op-equal.rs b/src/test/compile-fail/borrowck-init-op-equal.rs index cbe805551c2..8d4cb6714bc 100644 --- a/src/test/compile-fail/borrowck-init-op-equal.rs +++ b/src/test/compile-fail/borrowck-init-op-equal.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + fn test() { let v: int; v += 1; //~ ERROR use of possibly uninitialized variable: `v` diff --git a/src/test/compile-fail/borrowck-loan-vec-content.rs b/src/test/compile-fail/borrowck-loan-vec-content.rs index 200d208d140..393b528869a 100644 --- a/src/test/compile-fail/borrowck-loan-vec-content.rs +++ b/src/test/compile-fail/borrowck-loan-vec-content.rs @@ -18,15 +18,15 @@ fn takes_imm_elt(_v: &int, f: ||) { fn has_mut_vec_and_does_not_try_to_change_it() { let mut v = vec!(1, 2, 3); - takes_imm_elt(&v[0], || {}) + takes_imm_elt(v.get(0), || {}) } fn has_mut_vec_but_tries_to_change_it() { let mut v = vec!(1, 2, 3); takes_imm_elt( - &v[0], + v.get(0), || { //~ ERROR cannot borrow `v` as mutable - v[1] = 4; + *v.get_mut(1) = 4; }) } diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index 30ab71ad105..6724d76d0dc 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -21,7 +21,7 @@ pub fn main() { Foo { string: ~"bar" }, Foo { string: ~"baz" } ); - let x: &[Foo] = x; + let x: &[Foo] = x.as_slice(); match x { [_, ..tail] => { match tail { diff --git a/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs b/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs index b1ca61ebbcf..283d6398e9a 100644 --- a/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs +++ b/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs @@ -14,5 +14,5 @@ fn write(v: &mut [int]) { fn main() { let v = vec!(1, 2, 3); - write(v); //~ ERROR cannot borrow + write(v.as_mut_slice()); //~ ERROR cannot borrow } diff --git a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs index 22e35e4a84c..3da28417554 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs @@ -10,7 +10,7 @@ fn a() -> &[int] { let vec = vec!(1, 2, 3, 4); - let vec: &[int] = vec; //~ ERROR does not live long enough + let vec: &[int] = vec.as_slice(); //~ ERROR does not live long enough let tail = match vec { [_, ..tail] => tail, _ => fail!("a") @@ -20,7 +20,7 @@ fn a() -> &[int] { fn b() -> &[int] { let vec = vec!(1, 2, 3, 4); - let vec: &[int] = vec; //~ ERROR does not live long enough + let vec: &[int] = vec.as_slice(); //~ ERROR does not live long enough let init = match vec { [..init, _] => init, _ => fail!("b") @@ -30,7 +30,7 @@ fn b() -> &[int] { fn c() -> &[int] { let vec = vec!(1, 2, 3, 4); - let vec: &[int] = vec; //~ ERROR does not live long enough + let vec: &[int] = vec.as_slice(); //~ ERROR does not live long enough let slice = match vec { [_, ..slice, _] => slice, _ => fail!("c") diff --git a/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs b/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs index ca28b3cfd45..393ec8b0b1b 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs @@ -10,7 +10,7 @@ fn a() { let mut v = vec!(1, 2, 3); - let vb: &mut [int] = v; + let vb: &mut [int] = v.as_mut_slice(); match vb { [_a, ..tail] => { v.push(tail[0] + tail[1]); //~ ERROR cannot borrow diff --git a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs index a3b0c0ea359..e96ccd2aa8b 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs @@ -19,7 +19,7 @@ fn a() { fn b() { let mut vec = vec!(~1, ~2, ~3); - let vec: &mut [~int] = vec; + let vec: &mut [~int] = vec.as_mut_slice(); match vec { [.._b] => { vec[0] = ~4; //~ ERROR cannot assign @@ -29,7 +29,7 @@ fn b() { fn c() { let mut vec = vec!(~1, ~2, ~3); - let vec: &mut [~int] = vec; + let vec: &mut [~int] = vec.as_mut_slice(); match vec { [_a, .._b] => { //~^ ERROR cannot move out @@ -47,7 +47,7 @@ fn c() { fn d() { let mut vec = vec!(~1, ~2, ~3); - let vec: &mut [~int] = vec; + let vec: &mut [~int] = vec.as_mut_slice(); match vec { [.._a, _b] => { //~^ ERROR cannot move out @@ -59,7 +59,7 @@ fn d() { fn e() { let mut vec = vec!(~1, ~2, ~3); - let vec: &mut [~int] = vec; + let vec: &mut [~int] = vec.as_mut_slice(); match vec { [_a, _b, _c] => {} //~ ERROR cannot move out //~^ ERROR cannot move out diff --git a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs index 7b3db0151f6..26dc853859c 100644 --- a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs @@ -10,7 +10,7 @@ fn a() -> &int { let vec = vec!(1, 2, 3, 4); - let vec: &[int] = vec; //~ ERROR `vec[..]` does not live long enough + let vec: &[int] = vec.as_slice(); //~ ERROR `vec` does not live long enough let tail = match vec { [_a, ..tail] => &tail[0], _ => fail!("foo") diff --git a/src/test/compile-fail/drop-on-non-struct.rs b/src/test/compile-fail/drop-on-non-struct.rs index 8ab78648ff5..09274aaa504 100644 --- a/src/test/compile-fail/drop-on-non-struct.rs +++ b/src/test/compile-fail/drop-on-non-struct.rs @@ -10,10 +10,13 @@ #[feature(managed_boxes)]; -type Foo = Vec<u8> ; +use std::vec_ng::Vec; -impl Drop for Foo { //~ ERROR the Drop trait may only be implemented +type Foo = Vec<u8>; + +impl Drop for Foo { //~ ERROR conflicting implementations //~^ ERROR cannot provide an extension implementation +//~^^ ERROR multiple applicable methods fn drop(&mut self) { println!("kaboom"); } diff --git a/src/test/compile-fail/empty-vec-trailing-comma.rs b/src/test/compile-fail/empty-vec-trailing-comma.rs deleted file mode 100644 index 41cb351cdcd..00000000000 --- a/src/test/compile-fail/empty-vec-trailing-comma.rs +++ /dev/null @@ -1,13 +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. - -fn main() { - let v = vec!(); //~ ERROR unexpected token: `,` -} diff --git a/src/test/compile-fail/evec-subtyping.rs b/src/test/compile-fail/evec-subtyping.rs deleted file mode 100644 index 562a5580c00..00000000000 --- a/src/test/compile-fail/evec-subtyping.rs +++ /dev/null @@ -1,32 +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. - -#[feature(managed_boxes)]; - -fn wants_uniq(x: Vec<uint> ) { } -fn wants_three(x: [uint, ..3]) { } - -fn has_uniq(x: Vec<uint> ) { - wants_uniq(x); - wants_three(x); //~ ERROR [] storage differs: expected `3` but found `~` -} - -fn has_three(x: [uint, ..3]) { - wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `3` - wants_three(x); -} - -fn has_four(x: [uint, ..4]) { - wants_uniq(x); //~ ERROR [] storage differs: expected `~` but found `4` - wants_three(x); //~ ERROR [] storage differs: expected `3` but found `4` -} - -fn main() { -} diff --git a/src/test/compile-fail/import.rs b/src/test/compile-fail/import.rs index c5c6a375959..35a17f7e017 100644 --- a/src/test/compile-fail/import.rs +++ b/src/test/compile-fail/import.rs @@ -11,7 +11,10 @@ // error-pattern:failed to resolve import use zed::bar; use zed::baz; + +use std::vec_ng::Vec; + mod zed { pub fn bar() { println!("bar"); } } -fn main(args: vec!(str)) { bar(); } +fn main(args: Vec<~str>) { bar(); } diff --git a/src/test/compile-fail/import2.rs b/src/test/compile-fail/import2.rs index 0024f78009d..759e0c56f51 100644 --- a/src/test/compile-fail/import2.rs +++ b/src/test/compile-fail/import2.rs @@ -11,8 +11,10 @@ use baz::zed::bar; //~ ERROR unresolved import //~^ ERROR failed to resolve import +use std::vec_ng::Vec; + mod baz {} mod zed { pub fn bar() { println!("bar3"); } } -fn main(args: vec!(str)) { bar(); } +fn main(args: Vec<~str>) { bar(); } diff --git a/src/test/compile-fail/import4.rs b/src/test/compile-fail/import4.rs index feb94708520..8920349a27a 100644 --- a/src/test/compile-fail/import4.rs +++ b/src/test/compile-fail/import4.rs @@ -10,6 +10,8 @@ // error-pattern: import +use std::vec_ng::Vec; + mod a { pub use b::foo; } mod b { pub use a::foo; } diff --git a/src/test/compile-fail/infinite-vec-type-recursion.rs b/src/test/compile-fail/infinite-vec-type-recursion.rs index 409a5e72fed..c52199ecedd 100644 --- a/src/test/compile-fail/infinite-vec-type-recursion.rs +++ b/src/test/compile-fail/infinite-vec-type-recursion.rs @@ -10,6 +10,8 @@ // error-pattern: illegal recursive type -type x = vec!(x); +use std::vec_ng::Vec; + +type x = Vec<x>; fn main() { let b: x = Vec::new(); } diff --git a/src/test/compile-fail/issue-10487.rs b/src/test/compile-fail/issue-10487.rs deleted file mode 100644 index c2f40f56948..00000000000 --- a/src/test/compile-fail/issue-10487.rs +++ /dev/null @@ -1,15 +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. - -#[feature(managed_boxes)]; - -static x: Vec<int> = vec!(123, 456); //~ ERROR: static items are not allowed to have owned pointers - -fn main() {} diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs index ed35f3b306b..29f7e344b30 100644 --- a/src/test/compile-fail/issue-2149.rs +++ b/src/test/compile-fail/issue-2149.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + trait vec_monad<A> { fn bind<B>(&self, f: |A| -> Vec<B> ); } diff --git a/src/test/compile-fail/issue-2150.rs b/src/test/compile-fail/issue-2150.rs index ca49bd1a48a..69dd24522fb 100644 --- a/src/test/compile-fail/issue-2150.rs +++ b/src/test/compile-fail/issue-2150.rs @@ -13,6 +13,8 @@ #[allow(dead_code)]; #[allow(deprecated_owned_vector)]; +use std::vec_ng::Vec; + fn fail_len(v: Vec<int> ) -> uint { let mut i = 3; fail!(); diff --git a/src/test/compile-fail/issue-2548.rs b/src/test/compile-fail/issue-2548.rs deleted file mode 100644 index c2f48b7ca5b..00000000000 --- a/src/test/compile-fail/issue-2548.rs +++ /dev/null @@ -1,47 +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. - -#[feature(managed_boxes)]; - -// A test case for #2548. - -use std::cell::Cell; - -struct foo { - x: @Cell<int>, -} - -#[unsafe_destructor] -impl Drop for foo { - fn drop(&mut self) { - unsafe { - println!("Goodbye, World!"); - self.x.set(self.x.get() + 1); - } - } -} - -fn foo(x: @Cell<int>) -> foo { - foo { x: x } -} - -fn main() { - let x = @Cell::new(0); - - { - let mut res = foo(x); - - let mut v = Vec::new(); - v = vec!((res)) + v; //~ failed to find an implementation of trait - assert_eq!(v.len(), 2); - } - - assert_eq!(x.get(), 1); -} diff --git a/src/test/compile-fail/issue-2590.rs b/src/test/compile-fail/issue-2590.rs index 94c155fce9b..a3f2da150a3 100644 --- a/src/test/compile-fail/issue-2590.rs +++ b/src/test/compile-fail/issue-2590.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + struct parser { tokens: Vec<int> , } diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs index 3b1bceb453a..076c6015268 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/compile-fail/issue-3044.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + fn main() { let needlesArr: Vec<char> = vec!('a', 'f'); needlesArr.iter().fold(|x, y| { diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index c78e1a15058..633be15ef99 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + pub struct CrateId { local_path: ~str, junk: ~str diff --git a/src/test/compile-fail/issue-8727.rs b/src/test/compile-fail/issue-8727.rs index 4c9f4039723..9d7edefbf02 100644 --- a/src/test/compile-fail/issue-8727.rs +++ b/src/test/compile-fail/issue-8727.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[allow(deprecated_owned_vector)]; - // Verify the compiler fails with an error on infinite function // recursions. diff --git a/src/test/compile-fail/kindck-freeze.rs b/src/test/compile-fail/kindck-freeze.rs index bf10a029024..c5977678aba 100644 --- a/src/test/compile-fail/kindck-freeze.rs +++ b/src/test/compile-fail/kindck-freeze.rs @@ -10,6 +10,8 @@ // Test which of the builtin types are considered freezeable. +use std::vec_ng::Vec; + fn assert_freeze<T:Freeze>() { } trait Dummy { } diff --git a/src/test/compile-fail/kindck-pod.rs b/src/test/compile-fail/kindck-pod.rs index 94902d4e68e..bc4ee14d89e 100644 --- a/src/test/compile-fail/kindck-pod.rs +++ b/src/test/compile-fail/kindck-pod.rs @@ -13,6 +13,7 @@ #[feature(managed_boxes)]; use std::rc::Rc; +use std::vec_ng::Vec; fn assert_pod<T:Pod>() { } trait Dummy { } diff --git a/src/test/compile-fail/kindck-send.rs b/src/test/compile-fail/kindck-send.rs index 829bdaa5332..0eb3656cea7 100644 --- a/src/test/compile-fail/kindck-send.rs +++ b/src/test/compile-fail/kindck-send.rs @@ -10,6 +10,8 @@ // Test which of the builtin types are considered sendable. +use std::vec_ng::Vec; + fn assert_send<T:Send>() { } trait Dummy { } diff --git a/src/test/compile-fail/lint-heap-memory.rs b/src/test/compile-fail/lint-heap-memory.rs index 5391cd475aa..f4588801075 100644 --- a/src/test/compile-fail/lint-heap-memory.rs +++ b/src/test/compile-fail/lint-heap-memory.rs @@ -25,8 +25,6 @@ fn main() { @2; //~ ERROR type uses managed ~2; //~ ERROR type uses owned - vec!(1); //~ ERROR type uses owned - //~^ ERROR type uses owned fn g(_: ~Clone) {} //~ ERROR type uses owned ~""; //~ ERROR type uses owned //~^ ERROR type uses owned diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs index 275b37d9b7e..2adf833e4e4 100644 --- a/src/test/compile-fail/lint-unused-mut-variables.rs +++ b/src/test/compile-fail/lint-unused-mut-variables.rs @@ -16,6 +16,8 @@ #[allow(deprecated_owned_vector)]; #[deny(unused_mut)]; +use std::vec_ng::Vec; + fn main() { // negative cases let mut a = 3; //~ ERROR: variable does not need to be mutable diff --git a/src/test/compile-fail/lint-unused-unsafe.rs b/src/test/compile-fail/lint-unused-unsafe.rs index 2bf784faf00..81e8c39a28c 100644 --- a/src/test/compile-fail/lint-unused-unsafe.rs +++ b/src/test/compile-fail/lint-unused-unsafe.rs @@ -14,6 +14,8 @@ #[deny(unused_unsafe)]; #[allow(deprecated_owned_vector)]; +use std::vec_ng::Vec; + mod foo { extern { pub fn bar(); diff --git a/src/test/compile-fail/liveness-issue-2163.rs b/src/test/compile-fail/liveness-issue-2163.rs index 3d601957754..4bfa614063b 100644 --- a/src/test/compile-fail/liveness-issue-2163.rs +++ b/src/test/compile-fail/liveness-issue-2163.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::slice; +use std::vec::Vec; fn main() { let a: Vec<int> = Vec::new(); diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs index 31fdb220263..2112af7cd04 100644 --- a/src/test/compile-fail/match-vec-unreachable.rs +++ b/src/test/compile-fail/match-vec-unreachable.rs @@ -8,9 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + fn main() { let x: Vec<(int, int)> = Vec::new(); - let x: &[(int, int)] = x; + let x: &[(int, int)] = x.as_slice(); match x { [a, (2, 3), _] => (), [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern @@ -18,7 +20,7 @@ fn main() { } let x: Vec<~str> = vec!(~"foo", ~"bar", ~"baz"); - let x: &[~str] = x; + let x: &[~str] = x.as_slice(); match x { [a, _, _, ..] => { println!("{}", a); } [_, _, _, _, _] => { } //~ ERROR unreachable pattern @@ -26,7 +28,7 @@ fn main() { } let x: Vec<char> = vec!('a', 'b', 'c'); - let x: &[char] = x; + let x: &[char] = x.as_slice(); match x { ['a', 'b', 'c', .._tail] => {} ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern diff --git a/src/test/compile-fail/moves-based-on-type-access-to-field.rs b/src/test/compile-fail/moves-based-on-type-access-to-field.rs index 59bdc0b8a4d..657d5ad03e8 100644 --- a/src/test/compile-fail/moves-based-on-type-access-to-field.rs +++ b/src/test/compile-fail/moves-based-on-type-access-to-field.rs @@ -23,8 +23,8 @@ fn f10() { fn f20() { let x = vec!(~"hi"); - consume(x[0]); - touch(&x[0]); //~ ERROR use of partially moved value: `x` + consume(x.move_iter().next().unwrap()); + touch(x.get(0)); //~ ERROR use of moved value: `x` } fn main() {} diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index cfc57af092c..967612e7c50 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -31,7 +31,7 @@ fn f20() { fn f21() { let x = vec!(1, 2, 3); - let _y = (x[0], 3); + let _y = (*x.get(0), 3); touch(&x); } @@ -84,21 +84,21 @@ fn f80() { fn f100() { let x = vec!(~"hi"); - let _y = x[0]; - touch(&x); //~ ERROR use of partially moved value: `x` + let _y = x.move_iter().next().unwrap(); + touch(&x); //~ ERROR use of moved value: `x` } fn f110() { let x = vec!(~"hi"); - let _y = [x[0], ..1]; - touch(&x); //~ ERROR use of partially moved value: `x` + let _y = [x.move_iter().next().unwrap(), ..1]; + touch(&x); //~ ERROR use of moved value: `x` } fn f120() { let mut x = vec!(~"hi", ~"ho"); x.swap(0, 1); - touch(&x[0]); - touch(&x[1]); + touch(x.get(0)); + touch(x.get(1)); } fn main() {} diff --git a/src/test/compile-fail/no-capture-arc.rs b/src/test/compile-fail/no-capture-arc.rs index 7311a0d5302..e76c31469ea 100644 --- a/src/test/compile-fail/no-capture-arc.rs +++ b/src/test/compile-fail/no-capture-arc.rs @@ -21,10 +21,10 @@ fn main() { task::spawn(proc() { let v = arc_v.get(); - assert_eq!(v[3], 4); + assert_eq!(*v.get(3), 4); }); - assert_eq!((arc_v.get())[2], 3); + assert_eq!(*(arc_v.get()).get(2), 3); println!("{:?}", arc_v); } diff --git a/src/test/compile-fail/no-reuse-move-arc.rs b/src/test/compile-fail/no-reuse-move-arc.rs index 115be7e1485..29f62ff6e1b 100644 --- a/src/test/compile-fail/no-reuse-move-arc.rs +++ b/src/test/compile-fail/no-reuse-move-arc.rs @@ -19,10 +19,10 @@ fn main() { task::spawn(proc() { let v = arc_v.get(); - assert_eq!(v[3], 4); + assert_eq!(*v.get(3), 4); }); - assert_eq!((arc_v.get())[2], 3); //~ ERROR use of moved value: `arc_v` + assert_eq!(*(arc_v.get()).get(2), 3); //~ ERROR use of moved value: `arc_v` println!("{:?}", arc_v); //~ ERROR use of moved value: `arc_v` } diff --git a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs index 162b84d6cec..fd857129c35 100644 --- a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs +++ b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs @@ -11,6 +11,6 @@ enum State { ST_NULL, ST_WHITESPACE } fn main() { - vec!(ST_NULL, ..(ST_WHITESPACE as uint)); + [ST_NULL, ..(ST_WHITESPACE as uint)]; //~^ ERROR expected constant integer for repeat count but found variable } diff --git a/src/test/compile-fail/non-copyable-void.rs b/src/test/compile-fail/non-copyable-void.rs index bd9547d5e1c..2b3722196c1 100644 --- a/src/test/compile-fail/non-copyable-void.rs +++ b/src/test/compile-fail/non-copyable-void.rs @@ -9,6 +9,7 @@ // except according to those terms. use std::libc; +use std::vec_ng::Vec; fn main() { let x : *Vec<int> = &vec!(1,2,3); diff --git a/src/test/compile-fail/non-exhaustive-match.rs b/src/test/compile-fail/non-exhaustive-match.rs index 3bed415600f..a07fec853fc 100644 --- a/src/test/compile-fail/non-exhaustive-match.rs +++ b/src/test/compile-fail/non-exhaustive-match.rs @@ -36,7 +36,7 @@ fn main() { (b, b) => {} } let vec = vec!(Some(42), None, Some(21)); - let vec: &[Option<int>] = vec; + let vec: &[Option<int>] = vec.as_slice(); match vec { //~^ ERROR non-exhaustive patterns: vectors of length 0 not covered [Some(..), None, ..tail] => {} @@ -44,13 +44,13 @@ fn main() { [None] => {} } let vec = vec!(1); - let vec: &[int] = vec; + let vec: &[int] = vec.as_slice(); match vec { [_, ..tail] => (), [] => () } let vec = vec!(0.5); - let vec: &[f32] = vec; + let vec: &[f32] = vec.as_slice(); match vec { //~ ERROR non-exhaustive patterns: vectors of length 4 not covered [0.1, 0.2, 0.3] => (), [0.1, 0.2] => (), @@ -58,7 +58,7 @@ fn main() { [] => () } let vec = vec!(Some(42), None, Some(21)); - let vec: &[Option<int>] = vec; + let vec: &[Option<int>] = vec.as_slice(); match vec { [Some(..), None, ..tail] => {} [Some(..), Some(..), ..tail] => {} diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index a7340df83b4..38669a99b49 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - enum bar { t1((), Option<Vec<int>>), t2, } // n.b. my change changes this error message, but I think it's right -- tjc diff --git a/src/test/compile-fail/repeat_count.rs b/src/test/compile-fail/repeat_count.rs index 08c8eba696d..692c51b5b5f 100644 --- a/src/test/compile-fail/repeat_count.rs +++ b/src/test/compile-fail/repeat_count.rs @@ -12,5 +12,5 @@ fn main() { let n = 1; - let a = vec!(0, ..n); //~ ERROR expected constant integer for repeat count but found variable + let a = [0, ..n]; //~ ERROR expected constant integer for repeat count but found variable } diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index a135af29356..59c80474c4c 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -13,6 +13,8 @@ #[no_implicit_prelude]; +use std::vec_ng::Vec; + fn last<T>(v: Vec<&T> ) -> std::option::Option<T> { fail!(); } diff --git a/src/test/compile-fail/uninstantiable-fixed-length-vec.rs b/src/test/compile-fail/uninstantiable-fixed-length-vec.rs deleted file mode 100644 index a44010366c8..00000000000 --- a/src/test/compile-fail/uninstantiable-fixed-length-vec.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 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. - -// issue #11659, the compiler needs to know that a fixed length vector -// always requires instantiable contents to instantiable itself -// (unlike a ~[] vector which can have length zero). - -// ~ to avoid infinite size. -struct Uninstantiable { //~ ERROR cannot be instantiated without an instance of itself - p: vec!(Uninstantiable, .. 1) -} - -struct Instantiable { p: vec!(Instantiable, .. 0) } - - -fn main() { - let _ = None::<Uninstantiable>; - let _ = Instantiable { p: ~([]) }; -} diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index c76a6f2453e..e35a0c607c8 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -11,6 +11,7 @@ #[feature(managed_boxes)]; use std::cell::Cell; +use std::vec_ng::Vec; struct r { i: @Cell<int>, diff --git a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs index 4d57470a721..4dd3b26bad9 100644 --- a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs +++ b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs @@ -11,6 +11,7 @@ // ignore-tidy-linelength use std::fmt; +use std::vec_ng::Vec; struct Number { n: i64 diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs index be226b2e16e..985a094d5a8 100644 --- a/src/test/compile-fail/vector-no-ann.rs +++ b/src/test/compile-fail/vector-no-ann.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + fn main() { let _foo = Vec::new(); //~ ERROR unconstrained type } diff --git a/src/test/compile-fail/writing-to-immutable-vec.rs b/src/test/compile-fail/writing-to-immutable-vec.rs index 987a3c1674c..00d537f95bf 100644 --- a/src/test/compile-fail/writing-to-immutable-vec.rs +++ b/src/test/compile-fail/writing-to-immutable-vec.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::vec_ng::Vec; + fn main() { let v: Vec<int> = vec!(1, 2, 3); - v[1] = 4; //~ ERROR cannot assign + *v.get(1) = 4; //~ ERROR cannot assign } |
