Skip to content

Commit e416518

Browse files
committed
update test cases to reflect new messages
1 parent d9a947c commit e416518

File tree

121 files changed

+534
-630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+534
-630
lines changed

src/test/compile-fail/array-not-vector.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
fn main() {
1212
let _x: i32 = [1, 2, 3];
1313
//~^ ERROR mismatched types
14-
//~| expected `i32`
15-
//~| found `[_; 3]`
16-
//~| expected i32
17-
//~| found array of 3 elements
14+
//~| expected type `i32`
15+
//~| found type `[_; 3]`
16+
//~| expected i32, found array of 3 elements
1817

1918
let x: &[i32] = &[1, 2, 3];
2019
let _y: &i32 = x;
2120
//~^ ERROR mismatched types
22-
//~| expected `&i32`
23-
//~| found `&[i32]`
24-
//~| expected i32
25-
//~| found slice
21+
//~| expected type `&i32`
22+
//~| found type `&[i32]`
23+
//~| expected i32, found slice
2624
}

src/test/compile-fail/associated-types-eq-3.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ fn foo1<I: Foo<A=Bar>>(x: I) {
3232
fn foo2<I: Foo>(x: I) {
3333
let _: Bar = x.boo();
3434
//~^ ERROR mismatched types
35-
//~| expected `Bar`
36-
//~| found `<I as Foo>::A`
37-
//~| expected struct `Bar`
38-
//~| found associated type
35+
//~| expected type `Bar`
36+
//~| found type `<I as Foo>::A`
37+
//~| expected struct `Bar`, found associated type
3938
}
4039

4140

src/test/compile-fail/associated-types-path-2.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ pub fn f2<T: Foo>(a: T) -> T::A {
2828
pub fn f1_int_int() {
2929
f1(2i32, 4i32);
3030
//~^ ERROR mismatched types
31-
//~| expected `u32`
32-
//~| found `i32`
31+
//~| expected u32, found i32
3332
}
3433

3534
pub fn f1_int_uint() {
@@ -49,8 +48,7 @@ pub fn f1_uint_int() {
4948
pub fn f2_int() {
5049
let _: i32 = f2(2i32);
5150
//~^ ERROR mismatched types
52-
//~| expected `i32`
53-
//~| found `u32`
51+
//~| expected i32, found u32
5452
}
5553

5654
pub fn main() { }

src/test/compile-fail/augmented-assignments.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ impl AddAssign for Int {
2121
fn main() {
2222
let mut x = Int(1);
2323
x //~ error: use of moved value: `x`
24+
//~^ value used here after move
25+
//~| note: move occurs because `x` has type `Int`
2426
+=
25-
x; //~ note: `x` moved here because it has type `Int`, which is non-copyable
27+
x; //~ value moved here
2628

2729
let y = Int(2);
2830
y //~ error: cannot borrow immutable local variable `y` as mutable

src/test/compile-fail/bad-const-type.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
static i: String = 10;
1212
//~^ ERROR mismatched types
13-
//~| expected `std::string::String`
14-
//~| found `_`
15-
//~| expected struct `std::string::String`
16-
//~| found integral variable
13+
//~| expected type `std::string::String`
14+
//~| found type `_`
15+
//~| expected struct `std::string::String`, found integral variable
1716
fn main() { println!("{}", i); }

src/test/compile-fail/bad-main.rs

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

11-
fn main(x: isize) { } //~ ERROR: main function expects type
11+
fn main(x: isize) { } //~ ERROR: main function has wrong type

src/test/compile-fail/binop-move-semantics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fn mut_plus_immut() {
6262
&mut f
6363
+
6464
&f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
65+
//~^ cannot borrow `f` as immutable because it is also borrowed as mutable
6566
}
6667

6768
fn immut_plus_mut() {
@@ -70,6 +71,7 @@ fn immut_plus_mut() {
7071
&f
7172
+
7273
&mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
74+
//~^ cannot borrow `f` as mutable because it is also borrowed as immutable
7375
}
7476

7577
fn main() {}

src/test/compile-fail/block-must-not-have-result-while.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
fn main() {
1212
while true {
1313
true //~ ERROR mismatched types
14-
//~| expected `()`
15-
//~| found `bool`
16-
//~| expected ()
17-
//~| found bool
14+
//~| expected type `()`
15+
//~| found type `bool`
16+
//~| expected (), found bool
1817
}
1918
}

src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,28 @@ struct D {
3333
fn copy_after_move() {
3434
let a: Box<_> = box A { x: box 0, y: 1 };
3535
let _x = a.x;
36+
//~^ value moved here
3637
let _y = a.y; //~ ERROR use of moved
37-
//~^^ NOTE `a` moved here (through moving `a.x`)
38+
//~^ move occurs because `a.x` has type `Box<isize>`
39+
//~| value used here after move
3840
}
3941

4042
fn move_after_move() {
4143
let a: Box<_> = box B { x: box 0, y: box 1 };
4244
let _x = a.x;
45+
//~^ value moved here
4346
let _y = a.y; //~ ERROR use of moved
44-
//~^^ NOTE `a` moved here (through moving `a.x`)
47+
//~^ move occurs because `a.x` has type `Box<isize>`
48+
//~| value used here after move
4549
}
4650

4751
fn borrow_after_move() {
4852
let a: Box<_> = box A { x: box 0, y: 1 };
4953
let _x = a.x;
54+
//~^ value moved here
5055
let _y = &a.y; //~ ERROR use of moved
51-
//~^^ NOTE `a` moved here (through moving `a.x`)
56+
//~^ move occurs because `a.x` has type `Box<isize>`
57+
//~| value used here after move
5258
}
5359

5460
fn move_after_borrow() {
@@ -75,44 +81,52 @@ fn move_after_mut_borrow() {
7581
fn borrow_after_mut_borrow() {
7682
let mut a: Box<_> = box A { x: box 0, y: 1 };
7783
let _x = &mut a.x;
78-
//~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`);
84+
//~^ NOTE mutable borrow occurs here (via `a.x`)
7985
let _y = &a.y; //~ ERROR cannot borrow
86+
//~^ immutable borrow occurs here (via `a.y`)
8087
}
81-
//~^ NOTE previous borrow ends here
88+
//~^ NOTE mutable borrow ends here
8289

8390
fn mut_borrow_after_borrow() {
8491
let mut a: Box<_> = box A { x: box 0, y: 1 };
8592
let _x = &a.x;
86-
//~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`)
93+
//~^ NOTE immutable borrow occurs here (via `a.x`)
8794
let _y = &mut a.y; //~ ERROR cannot borrow
95+
//~^ mutable borrow occurs here (via `a.y`)
8896
}
89-
//~^ NOTE previous borrow ends here
97+
//~^ NOTE immutable borrow ends here
9098

9199
fn copy_after_move_nested() {
92100
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
93101
let _x = a.x.x;
94-
//~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
102+
//~^ value moved here
95103
let _y = a.y; //~ ERROR use of collaterally moved
104+
//~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
105+
//~| value used here after move
96106
}
97107

98108
fn move_after_move_nested() {
99109
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
100110
let _x = a.x.x;
101-
//~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
111+
//~^ value moved here
102112
let _y = a.y; //~ ERROR use of collaterally moved
113+
//~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
114+
//~| value used here after move
103115
}
104116

105117
fn borrow_after_move_nested() {
106118
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
107119
let _x = a.x.x;
108-
//~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
120+
//~^ value moved here
109121
let _y = &a.y; //~ ERROR use of collaterally moved
122+
//~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
123+
//~| value used here after move
110124
}
111125

112126
fn move_after_borrow_nested() {
113127
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
114128
let _x = &a.x.x;
115-
//~^ NOTE borrow of `a.x.x` occurs here
129+
//~^ borrow of `a.x.x` occurs here
116130
let _y = a.y; //~ ERROR cannot move
117131
}
118132

@@ -133,18 +147,20 @@ fn move_after_mut_borrow_nested() {
133147
fn borrow_after_mut_borrow_nested() {
134148
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
135149
let _x = &mut a.x.x;
136-
//~^ NOTE previous borrow of `a.x.x` occurs here; the mutable borrow prevents
150+
//~^ mutable borrow occurs here
137151
let _y = &a.y; //~ ERROR cannot borrow
152+
//~^ immutable borrow occurs here
138153
}
139-
//~^ NOTE previous borrow ends here
154+
//~^ NOTE mutable borrow ends here
140155

141156
fn mut_borrow_after_borrow_nested() {
142157
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
143158
let _x = &a.x.x;
144-
//~^ NOTE previous borrow of `a.x.x` occurs here; the immutable borrow prevents
159+
//~^ immutable borrow occurs here
145160
let _y = &mut a.y; //~ ERROR cannot borrow
161+
//~^ mutable borrow occurs here
146162
}
147-
//~^ NOTE previous borrow ends here
163+
//~^ NOTE immutable borrow ends here
148164

149165
fn main() {
150166
copy_after_move();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn a(x: &isize) {
2424
//~^ ERROR cannot borrow
2525
let c2 = || set(&mut *x);
2626
//~^ ERROR cannot borrow
27-
//~| ERROR closure requires unique access
27+
//~| ERROR two closures require unique access to `x` at the same time
2828
}
2929

3030
fn main() {

0 commit comments

Comments
 (0)