Skip to content

Commit df04bd6

Browse files
committed
Revert RIMOV to compile-fail tests
1 parent 3e2ed18 commit df04bd6

22 files changed

+59
-59
lines changed

src/test/compile-fail/alt-vec-tail-move.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
2-
let mut a = [1, 2, 3, 4];
2+
let a = [mut 1, 2, 3, 4];
33
let _ = match a {
44
[1, 2, ..move tail] => tail,
55
_ => core::util::unreachable()

src/test/compile-fail/assign-super.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let mut x: ~[int] = ~[3];
12+
let mut x: ~[mut int] = ~[mut 3];
1313
let y: ~[int] = ~[3];
1414
x = y; //~ ERROR values differ in mutability
1515
}

src/test/compile-fail/borrowck-assign-comp-idx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
type point = { x: int, y: int };
1212

1313
fn a() {
14-
let mut p = ~[1];
14+
let mut p = ~[mut 1];
1515

1616
// Create an immutable pointer into p's contents:
1717
let _q: &int = &p[0]; //~ NOTE loan of mutable vec content granted here
@@ -25,7 +25,7 @@ fn b() {
2525
// here we alias the mutable vector into an imm slice and try to
2626
// modify the original:
2727

28-
let mut p = ~[1];
28+
let mut p = ~[mut 1];
2929

3030
do borrow(p) { //~ NOTE loan of mutable vec content granted here
3131
p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
@@ -35,7 +35,7 @@ fn b() {
3535
fn c() {
3636
// Legal because the scope of the borrow does not include the
3737
// modification:
38-
let mut p = ~[1];
38+
let mut p = ~[mut 1];
3939
borrow(p, ||{});
4040
p[0] = 5;
4141
}

src/test/compile-fail/borrowck-loan-vec-content.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ fn takes_imm_elt(_v: &int, f: fn()) {
1717
}
1818

1919
fn has_mut_vec_and_does_not_try_to_change_it() {
20-
let mut v = ~[1, 2, 3];
20+
let v = ~[mut 1, 2, 3];
2121
do takes_imm_elt(&v[0]) {
2222
}
2323
}
2424

2525
fn has_mut_vec_but_tries_to_change_it() {
26-
let mut v = ~[1, 2, 3];
26+
let v = ~[mut 1, 2, 3];
2727
do takes_imm_elt(&v[0]) { //~ NOTE loan of mutable vec content granted here
2828
v[1] = 4; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
2929
}
@@ -34,7 +34,7 @@ fn takes_const_elt(_v: &const int, f: fn()) {
3434
}
3535

3636
fn has_mut_vec_and_tries_to_change_it() {
37-
let mut v = ~[1, 2, 3];
37+
let v = ~[mut 1, 2, 3];
3838
do takes_const_elt(&const v[0]) {
3939
v[1] = 4;
4040
}

src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn write(v: &mut [int]) {
11+
fn write(v: &[mut int]) {
1212
v[0] += 1;
1313
}
1414

src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ fn want_slice(v: &[int]) -> int {
1414
return sum;
1515
}
1616

17-
fn has_mut_vec(+v: @~[int]) -> int {
17+
fn has_mut_vec(+v: @~[mut int]) -> int {
1818
want_slice(*v) //~ ERROR illegal borrow unless pure
1919
//~^ NOTE impure due to access to impure function
2020
}
2121

2222
fn main() {
23-
assert has_mut_vec(@~[1, 2, 3]) == 6;
23+
assert has_mut_vec(@~[mut 1, 2, 3]) == 6;
2424
}

src/test/compile-fail/issue-2548.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fn main() {
3333
{
3434
let mut res = foo(x);
3535

36-
let mut v = ~[];
37-
v = move ~[(move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `&static`, missing `copy`)
36+
let mut v = ~[mut];
37+
v = move ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `&static`, missing `copy`)
3838
assert (v.len() == 2);
3939
}
4040

src/test/compile-fail/issue-2969.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
fn main()
1313
{
1414
// See #2969 -- error message should be improved
15-
let mut x = [1, 2, 4];
15+
let mut x = [mut 1, 2, 4];
1616
let v : &int = &x[2];
1717
x[2] = 6;
1818
assert *v == 6;

src/test/compile-fail/issue-3243.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
// xfail-test
12-
fn function() -> &mut [int] {
13-
let mut x: &static/[int] = &[1,2,3];
12+
fn function() -> &[mut int] {
13+
let mut x: &static/[mut int] = &[mut 1,2,3];
1414
x[0] = 12345;
1515
x //~ ERROR bad
1616
}

src/test/compile-fail/lub-in-args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn two_args<T>(x: T, y: T) { }
1212

1313
fn main() {
14-
let mut x: ~[int] = ~[3];
14+
let x: ~[mut int] = ~[mut 3];
1515
let y: ~[int] = ~[3];
1616
let a: @mut int = @mut 3;
1717
let b: @int = @3;

src/test/compile-fail/mutable-huh-variance-box.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let v = @mut ~[0];
1515

1616
fn f(&&v: @mut ~[const int]) {
17-
*v = ~[3]
17+
*v = ~[mut 3]
1818
}
1919

2020
f(v);

src/test/compile-fail/mutable-huh-variance-deep.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// error-pattern: mismatched types
1212

1313
fn main() {
14-
let mut v = ~[@mut ~mut ~[0]];
14+
let v = ~[mut @mut ~mut ~[0]];
1515

16-
fn f(&&v: ~[@mut ~mut ~[const int]]) {
16+
fn f(&&v: ~[mut @mut ~mut ~[const int]]) {
1717
}
1818

1919
f(v);

src/test/compile-fail/mutable-huh-variance-ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818

1919
fn f(&&v: *mut ~[const int]) {
2020
unsafe {
21-
*v = ~[3]
21+
*v = ~[mut 3]
2222
}
2323
}
2424

src/test/compile-fail/mutable-huh-variance-rec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let v = {mut g: ~[0]};
1515

1616
fn f(&&v: {mut g: ~[const int]}) {
17-
v.g = ~[3]
17+
v.g = ~[mut 3]
1818
}
1919

2020
f(v);

src/test/compile-fail/mutable-huh-variance-unique.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
let v = ~mut ~[0];
1515

1616
fn f(&&v: ~mut ~[const int]) {
17-
*v = ~[3]
17+
*v = ~[mut 3]
1818
}
1919

2020
f(v);

src/test/compile-fail/mutable-huh-variance-vec1.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
fn main() {
1212
// Note: explicit type annot is required here
1313
// because otherwise the inference gets smart
14-
// and assigns a type of ~[~[const int]].
15-
let mut v: ~[~[int]] = ~[~[0]];
14+
// and assigns a type of ~[mut ~[const int]].
15+
let v: ~[mut ~[int]] = ~[mut ~[0]];
1616

17-
fn f(&&v: ~[~[const int]]) {
18-
v[0] = ~[3]
17+
fn f(&&v: ~[mut ~[const int]]) {
18+
v[0] = ~[mut 3]
1919
}
2020

2121
f(v); //~ ERROR (values differ in mutability)

src/test/compile-fail/mutable-huh-variance-vec2.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
fn main() {
1212
// Note: explicit type annot is required here
1313
// because otherwise the inference gets smart
14-
// and assigns a type of ~[~[const int]].
15-
let mut v: ~[~[int]] = ~[~[0]];
14+
// and assigns a type of ~[mut ~[const int]].
15+
let v: ~[mut ~[mut int]] = ~[mut ~[mut 0]];
1616

17-
fn f(&&v: ~[~[const int]]) {
17+
fn f(&&v: ~[mut ~[const int]]) {
1818
v[0] = ~[3]
1919
}
2020

src/test/compile-fail/mutable-huh-variance-vec3.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
fn main() {
1212
// Note: explicit type annot is required here
1313
// because otherwise the inference gets smart
14-
// and assigns a type of ~[~[const int]].
15-
let mut v: ~[~[~[int]]] = ~[~[~[0]]];
14+
// and assigns a type of ~[mut ~[const int]].
15+
let v: ~[mut ~[mut ~[int]]] = ~[mut ~[mut ~[0]]];
1616

17-
fn f(&&v: ~[~[~[const int]]]) {
18-
v[0][1] = ~[3]
17+
fn f(&&v: ~[mut ~[mut ~[const int]]]) {
18+
v[0][1] = ~[mut 3]
1919
}
2020

2121
f(v); //~ ERROR (values differ in mutability)

src/test/compile-fail/mutable-huh-variance-vec4.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ fn main() {
1313
// Note: here we do not have any type annotations
1414
// but we do express conflicting requirements:
1515

16-
let mut v = ~[~[0]];
17-
let mut w = ~[~[0]];
18-
let mut x = ~[~[0]];
16+
let v = ~[mut ~[0]];
17+
let w = ~[mut ~[mut 0]];
18+
let x = ~[mut ~[mut 0]];
1919

20-
fn f(&&v: ~[~[int]]) {
20+
fn f(&&v: ~[mut ~[int]]) {
2121
v[0] = ~[3]
2222
}
2323

2424
fn g(&&v: ~[const ~[const int]]) {
2525
}
2626

27-
fn h(&&v: ~[~[int]]) {
28-
v[0] = ~[3]
27+
fn h(&&v: ~[mut ~[mut int]]) {
28+
v[0] = ~[mut 3]
2929
}
3030

31-
fn i(&&v: ~[~[const int]]) {
32-
v[0] = ~[3]
31+
fn i(&&v: ~[mut ~[const int]]) {
32+
v[0] = ~[mut 3]
3333
}
3434

3535
fn j(&&v: ~[~[const int]]) {
@@ -48,7 +48,7 @@ fn main() {
4848
j(w); //~ ERROR (values differ in mutability)
4949

5050
// Note that without adding f() or h() to the mix, it is valid for
51-
// x to have the type ~[~[const int]], and thus we can safely
51+
// x to have the type ~[mut ~[const int]], and thus we can safely
5252
// call g() and i() but not j():
5353
g(x);
5454
i(x);

src/test/compile-fail/non-const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn main() {
4444
foo({f: 3});
4545
foo({mut f: 3}); //~ ERROR missing `const`
4646
foo(~[1]);
47-
foo(~[1]); //~ ERROR missing `const`
47+
foo(~[mut 1]); //~ ERROR missing `const`
4848
foo(~1);
4949
foo(~mut 1); //~ ERROR missing `const`
5050
foo(@1);

src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
struct invariant {
12-
f: @mut [&int]
12+
f: @[mut &int]
1313
}
1414

1515
fn to_same_lifetime(bi: invariant/&r) {
@@ -25,4 +25,4 @@ fn to_longer_lifetime(bi: invariant/&r) -> invariant/&static {
2525
}
2626

2727
fn main() {
28-
}
28+
}

src/test/compile-fail/vec-add.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// the right hand side in all cases. We are getting compiler errors
1515
// about this now, so I'm xfailing the test for now. -eholk
1616

17-
fn add(i: ~[int], m: ~[int], c: ~[const int]) {
17+
fn add(i: ~[int], m: ~[mut int], c: ~[const int]) {
1818

1919
// Check that:
2020
// (1) vectors of any two mutabilities can be added
@@ -24,9 +24,9 @@ fn add(i: ~[int], m: ~[int], c: ~[const int]) {
2424
m + ~[3],
2525
~[3]);
2626

27-
add(i + ~[3],
28-
m + ~[3],
29-
~[3]);
27+
add(i + ~[mut 3],
28+
m + ~[mut 3],
29+
~[mut 3]);
3030

3131
add(i + i,
3232
m + i,
@@ -54,19 +54,19 @@ fn add(i: ~[int], m: ~[int], c: ~[const int]) {
5454
//~^ mismatched types
5555
~[3]);
5656

57-
add(m + ~[3], //~ ERROR mismatched types
58-
m + ~[3],
59-
m + ~[3]);
57+
add(m + ~[mut 3], //~ ERROR mismatched types
58+
m + ~[mut 3],
59+
m + ~[mut 3]);
6060

61-
add(i + ~[3],
62-
i + ~[3], //~ ERROR mismatched types
63-
i + ~[3]);
61+
add(i + ~[mut 3],
62+
i + ~[mut 3], //~ ERROR mismatched types
63+
i + ~[mut 3]);
6464

65-
add(c + ~[3], //~ ERROR binary operation + cannot be applied
65+
add(c + ~[mut 3], //~ ERROR binary operation + cannot be applied
6666
//~^ mismatched types
67-
c + ~[3], //~ ERROR binary operation + cannot be applied
67+
c + ~[mut 3], //~ ERROR binary operation + cannot be applied
6868
//~^ mismatched types
69-
~[3]);
69+
~[mut 3]);
7070

7171
add(m + i, //~ ERROR mismatched types
7272
m + i,

0 commit comments

Comments
 (0)