about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-02-25 17:28:40 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-02-26 04:18:12 -0800
commit8fceee6c88ee58a506b9d2d9f5f04c1dc423214c (patch)
tree0a679d6d68a36e095d6ab929b79ad393c3abd8a2
parent96bdc349303c1bd55ebba4e2dd5f7f51e087dad2 (diff)
downloadrust-8fceee6c88ee58a506b9d2d9f5f04c1dc423214c.tar.gz
rust-8fceee6c88ee58a506b9d2d9f5f04c1dc423214c.zip
test: De-[mut] (remove all mutable arrays from) the tests. rs=demuting
-rw-r--r--src/test/compile-fail/assign-super.rs15
-rw-r--r--src/test/compile-fail/borrowck-assign-comp-idx.rs6
-rw-r--r--src/test/compile-fail/borrowck-loan-vec-content.rs6
-rw-r--r--src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs2
-rw-r--r--src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs24
-rw-r--r--src/test/compile-fail/borrowck-vec-pattern-move-tail.rs2
-rw-r--r--src/test/compile-fail/issue-2969.rs2
-rw-r--r--src/test/compile-fail/issue-3243.rs4
-rw-r--r--src/test/compile-fail/lub-in-args.rs3
-rw-r--r--src/test/compile-fail/mutable-huh-variance-box.rs21
-rw-r--r--src/test/compile-fail/mutable-huh-variance-deep.rs20
-rw-r--r--src/test/compile-fail/mutable-huh-variance-ptr.rs26
-rw-r--r--src/test/compile-fail/mutable-huh-variance-vec1.rs22
-rw-r--r--src/test/compile-fail/mutable-huh-variance-vec2.rs22
-rw-r--r--src/test/compile-fail/mutable-huh-variance-vec3.rs22
-rw-r--r--src/test/compile-fail/mutable-huh-variance-vec4.rs56
-rw-r--r--src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs2
-rw-r--r--src/test/compile-fail/vec-add.rs26
18 files changed, 25 insertions, 256 deletions
diff --git a/src/test/compile-fail/assign-super.rs b/src/test/compile-fail/assign-super.rs
deleted file mode 100644
index 17c7ff1bb60..00000000000
--- a/src/test/compile-fail/assign-super.rs
+++ /dev/null
@@ -1,15 +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 mut x: ~[mut int] = ~[mut 3];
-    let y: ~[int] = ~[3];
-    x = y; //~ ERROR values differ in mutability
-}
diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs
index 21236dc4a83..ded47fc9f7f 100644
--- a/src/test/compile-fail/borrowck-assign-comp-idx.rs
+++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs
@@ -11,7 +11,7 @@
 type point = { x: int, y: int };
 
 fn a() {
-    let mut p = ~[mut 1];
+    let mut p = ~[1];
 
     // Create an immutable pointer into p's contents:
     let _q: &int = &p[0]; //~ NOTE loan of mutable vec content granted here
@@ -25,7 +25,7 @@ fn b() {
     // here we alias the mutable vector into an imm slice and try to
     // modify the original:
 
-    let mut p = ~[mut 1];
+    let mut p = ~[1];
 
     do borrow(p) { //~ NOTE loan of mutable vec content granted here
         p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
@@ -35,7 +35,7 @@ fn b() {
 fn c() {
     // Legal because the scope of the borrow does not include the
     // modification:
-    let mut p = ~[mut 1];
+    let mut p = ~[1];
     borrow(p, ||{});
     p[0] = 5;
 }
diff --git a/src/test/compile-fail/borrowck-loan-vec-content.rs b/src/test/compile-fail/borrowck-loan-vec-content.rs
index b0b22dcfe61..8457fce255e 100644
--- a/src/test/compile-fail/borrowck-loan-vec-content.rs
+++ b/src/test/compile-fail/borrowck-loan-vec-content.rs
@@ -17,13 +17,13 @@ fn takes_imm_elt(_v: &int, f: fn()) {
 }
 
 fn has_mut_vec_and_does_not_try_to_change_it() {
-    let v = ~[mut 1, 2, 3];
+    let mut v = ~[1, 2, 3];
     do takes_imm_elt(&v[0]) {
     }
 }
 
 fn has_mut_vec_but_tries_to_change_it() {
-    let v = ~[mut 1, 2, 3];
+    let mut v = ~[1, 2, 3];
     do takes_imm_elt(&v[0]) { //~ NOTE loan of mutable vec content granted here
         v[1] = 4; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
     }
@@ -34,7 +34,7 @@ fn takes_const_elt(_v: &const int, f: fn()) {
 }
 
 fn has_mut_vec_and_tries_to_change_it() {
-    let v = ~[mut 1, 2, 3];
+    let mut v = ~[1, 2, 3];
     do takes_const_elt(&const v[0]) {
         v[1] = 4;
     }
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 51448d6061e..bc0340983ae 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
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn write(v: &[mut int]) {
+fn write(v: &mut [int]) {
     v[0] += 1;
 }
 
diff --git a/src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs b/src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs
deleted file mode 100644
index 43feb65c8b9..00000000000
--- a/src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs
+++ /dev/null
@@ -1,24 +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 want_slice(v: &[int]) -> int {
-    let mut sum = 0;
-    for vec::each(v) |i| { sum += *i; }
-    return sum;
-}
-
-fn has_mut_vec(+v: @~[mut int]) -> int {
-    want_slice(*v) //~ ERROR illegal borrow unless pure
-        //~^ NOTE impure due to access to impure function
-}
-
-fn main() {
-    assert has_mut_vec(@~[mut 1, 2, 3]) == 6;
-}
diff --git a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
index 941883f80f9..16b48aedb0c 100644
--- a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
+++ b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
@@ -1,5 +1,5 @@
 fn main() {
-    let a = [mut 1, 2, 3, 4];
+    let mut a = [1, 2, 3, 4];
     let _ = match a {
         [1, 2, ..tail] => tail,
         _ => core::util::unreachable()
diff --git a/src/test/compile-fail/issue-2969.rs b/src/test/compile-fail/issue-2969.rs
index 5e1b9397247..88c76fb31a1 100644
--- a/src/test/compile-fail/issue-2969.rs
+++ b/src/test/compile-fail/issue-2969.rs
@@ -12,7 +12,7 @@
 fn main()
 {
 // See #2969 -- error message should be improved
-   let mut x = [mut 1, 2, 4];
+   let mut x = [1, 2, 4];
    let v : &int = &x[2];
    x[2] = 6;
    assert *v == 6;
diff --git a/src/test/compile-fail/issue-3243.rs b/src/test/compile-fail/issue-3243.rs
index ac5c099e114..443fae619ba 100644
--- a/src/test/compile-fail/issue-3243.rs
+++ b/src/test/compile-fail/issue-3243.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 // xfail-test
-fn function() -> &[mut int] {
-    let mut x: &static/[mut int] = &[mut 1,2,3];
+fn function() -> &mut [int] {
+    let mut x: &static/mut [int] = &[1,2,3];
     x[0] = 12345;
     x //~ ERROR bad
 }
diff --git a/src/test/compile-fail/lub-in-args.rs b/src/test/compile-fail/lub-in-args.rs
index c2879d7f272..5c71ae38a64 100644
--- a/src/test/compile-fail/lub-in-args.rs
+++ b/src/test/compile-fail/lub-in-args.rs
@@ -11,8 +11,6 @@
 fn two_args<T>(x: T, y: T) { }
 
 fn main() {
-    let x: ~[mut int] = ~[mut 3];
-    let y: ~[int] = ~[3];
     let a: @mut int = @mut 3;
     let b: @int = @3;
 
@@ -22,6 +20,5 @@ fn main() {
     // shortcoming of the current inference algorithm.  These errors
     // are *not* desirable.
 
-    two_args(x, y); //~ ERROR (values differ in mutability)
     two_args(a, b); //~ ERROR (values differ in mutability)
 }
diff --git a/src/test/compile-fail/mutable-huh-variance-box.rs b/src/test/compile-fail/mutable-huh-variance-box.rs
deleted file mode 100644
index 316c832f011..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-box.rs
+++ /dev/null
@@ -1,21 +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.
-
-// error-pattern: mismatched types
-
-fn main() {
-    let v = @mut ~[0];
-
-    fn f(&&v: @mut ~[const int]) {
-        *v = ~[mut 3]
-    }
-
-    f(v);
-}
diff --git a/src/test/compile-fail/mutable-huh-variance-deep.rs b/src/test/compile-fail/mutable-huh-variance-deep.rs
deleted file mode 100644
index 51d5a6177f6..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-deep.rs
+++ /dev/null
@@ -1,20 +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.
-
-// error-pattern: mismatched types
-
-fn main() {
-    let v = @[mut @mut @mut @[0]];
-
-    fn f(&&v: @[mut @mut @mut @[const int]]) {
-    }
-
-    f(v);
-}
diff --git a/src/test/compile-fail/mutable-huh-variance-ptr.rs b/src/test/compile-fail/mutable-huh-variance-ptr.rs
deleted file mode 100644
index dba6f9ae3fa..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-ptr.rs
+++ /dev/null
@@ -1,26 +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.
-
-// error-pattern: mismatched types
-
-extern mod std;
-
-fn main() {
-    let mut a = ~[0];
-    let v: *mut ~[int] = &mut a;
-
-    fn f(&&v: *mut ~[const int]) {
-        unsafe {
-            *v = ~[mut 3]
-        }
-    }
-
-    f(v);
-}
diff --git a/src/test/compile-fail/mutable-huh-variance-vec1.rs b/src/test/compile-fail/mutable-huh-variance-vec1.rs
deleted file mode 100644
index c3f4636f898..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-vec1.rs
+++ /dev/null
@@ -1,22 +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() {
-    // Note: explicit type annot is required here
-    // because otherwise the inference gets smart
-    // and assigns a type of ~[mut ~[const int]].
-    let v: ~[mut ~[int]] = ~[mut ~[0]];
-
-    fn f(&&v: ~[mut ~[const int]]) {
-        v[0] = ~[mut 3]
-    }
-
-    f(v); //~ ERROR (values differ in mutability)
-}
diff --git a/src/test/compile-fail/mutable-huh-variance-vec2.rs b/src/test/compile-fail/mutable-huh-variance-vec2.rs
deleted file mode 100644
index aeb06324341..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-vec2.rs
+++ /dev/null
@@ -1,22 +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() {
-    // Note: explicit type annot is required here
-    // because otherwise the inference gets smart
-    // and assigns a type of ~[mut ~[const int]].
-    let v: ~[mut ~[mut int]] = ~[mut ~[mut 0]];
-
-    fn f(&&v: ~[mut ~[const int]]) {
-        v[0] = ~[3]
-    }
-
-    f(v); //~ ERROR (values differ in mutability)
-}
diff --git a/src/test/compile-fail/mutable-huh-variance-vec3.rs b/src/test/compile-fail/mutable-huh-variance-vec3.rs
deleted file mode 100644
index edc66536e9b..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-vec3.rs
+++ /dev/null
@@ -1,22 +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() {
-    // Note: explicit type annot is required here
-    // because otherwise the inference gets smart
-    // and assigns a type of ~[mut ~[const int]].
-    let v: ~[mut ~[mut ~[int]]] = ~[mut ~[mut ~[0]]];
-
-    fn f(&&v: ~[mut ~[mut ~[const int]]]) {
-        v[0][1] = ~[mut 3]
-    }
-
-    f(v); //~ ERROR (values differ in mutability)
-}
diff --git a/src/test/compile-fail/mutable-huh-variance-vec4.rs b/src/test/compile-fail/mutable-huh-variance-vec4.rs
deleted file mode 100644
index e0980826a2a..00000000000
--- a/src/test/compile-fail/mutable-huh-variance-vec4.rs
+++ /dev/null
@@ -1,56 +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() {
-
-    // Note: here we do not have any type annotations
-    // but we do express conflicting requirements:
-
-    let v = ~[mut ~[0]];
-    let w = ~[mut ~[mut 0]];
-    let x = ~[mut ~[mut 0]];
-
-    fn f(&&v: ~[mut ~[int]]) {
-        v[0] = ~[3]
-    }
-
-    fn g(&&v: ~[const ~[const int]]) {
-    }
-
-    fn h(&&v: ~[mut ~[mut int]]) {
-        v[0] = ~[mut 3]
-    }
-
-    fn i(&&v: ~[mut ~[const int]]) {
-        v[0] = ~[mut 3]
-    }
-
-    fn j(&&v: ~[~[const int]]) {
-    }
-
-    f(v);
-    g(v);
-    h(v); //~ ERROR (values differ in mutability)
-    i(v); //~ ERROR (values differ in mutability)
-    j(v); //~ ERROR (values differ in mutability)
-
-    f(w); //~ ERROR (values differ in mutability)
-    g(w);
-    h(w);
-    i(w); //~ ERROR (values differ in mutability)
-    j(w); //~ ERROR (values differ in mutability)
-
-    // Note that without adding f() or h() to the mix, it is valid for
-    // x to have the type ~[mut ~[const int]], and thus we can safely
-    // call g() and i() but not j():
-    g(x);
-    i(x);
-    j(x); //~ ERROR (values differ in mutability)
-}
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs
index 1a20ca23fae..4b637b0195c 100644
--- a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs
+++ b/src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct invariant {
-    f: @[mut &int]
+    f: @mut [&int]
 }
 
 fn to_same_lifetime(bi: invariant/&r) {
diff --git a/src/test/compile-fail/vec-add.rs b/src/test/compile-fail/vec-add.rs
index 0eaf40e110f..0f51d34fc2f 100644
--- a/src/test/compile-fail/vec-add.rs
+++ b/src/test/compile-fail/vec-add.rs
@@ -14,7 +14,7 @@
 // the right hand side in all cases. We are getting compiler errors
 // about this now, so I'm xfailing the test for now. -eholk
 
-fn add(i: ~[int], m: ~[mut int], c: ~[const int]) {
+fn add(i: ~[int], mut m: ~[int], c: ~[const int]) {
 
     // Check that:
     //  (1) vectors of any two mutabilities can be added
@@ -24,9 +24,9 @@ fn add(i: ~[int], m: ~[mut int], c: ~[const int]) {
        m + ~[3],
        ~[3]);
 
-   add(i + ~[mut 3],
-       m + ~[mut 3],
-       ~[mut 3]);
+   add(i + ~[3],
+       m + ~[3],
+       ~[3]);
 
    add(i + i,
        m + i,
@@ -54,19 +54,19 @@ fn add(i: ~[int], m: ~[mut int], c: ~[const int]) {
                 //~^ mismatched types
        ~[3]);
 
-   add(m + ~[mut 3], //~ ERROR mismatched types
-       m + ~[mut 3],
-       m + ~[mut 3]);
+   add(m + ~[3], //~ ERROR mismatched types
+       m + ~[3],
+       m + ~[3]);
 
-   add(i + ~[mut 3],
-       i + ~[mut 3], //~ ERROR mismatched types
-       i + ~[mut 3]);
+   add(i + ~[3],
+       i + ~[3], //~ ERROR mismatched types
+       i + ~[3]);
 
-   add(c + ~[mut 3], //~ ERROR binary operation + cannot be applied
+   add(c + ~[3], //~ ERROR binary operation + cannot be applied
                     //~^ mismatched types
-       c + ~[mut 3], //~ ERROR binary operation + cannot be applied
+       c + ~[3], //~ ERROR binary operation + cannot be applied
                     //~^ mismatched types
-       ~[mut 3]);
+       ~[3]);
 
    add(m + i, //~ ERROR mismatched types
        m + i,