Skip to content

Commit 9b6a568

Browse files
committed
Fix the expected error annotations.
(The commit prior to this actual passes our test suite, "thanks" to rust-lang#55695. But since I am aware of that bug, I took advantage of it in choosing how to order my commit series...)
1 parent d0151ca commit 9b6a568

File tree

3 files changed

+65
-65
lines changed

3 files changed

+65
-65
lines changed

src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr

+21-21
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ error[E0382]: use of moved value: `a`
33
|
44
LL | let _x = a.x;
55
| -- value moved here
6-
LL | //~^ value moved here
7-
LL | let _y = a.y; //~ ERROR use of moved
6+
LL | //[ast]~^ value moved here
7+
LL | let _y = a.y; //[ast]~ ERROR use of moved
88
| ^^ value used here after move
99
|
1010
= note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -14,8 +14,8 @@ error[E0382]: use of moved value: `a`
1414
|
1515
LL | let _x = a.x;
1616
| -- value moved here
17-
LL | //~^ value moved here
18-
LL | let _y = a.y; //~ ERROR use of moved
17+
LL | //[ast]~^ value moved here
18+
LL | let _y = a.y; //[ast]~ ERROR use of moved
1919
| ^^ value used here after move
2020
|
2121
= note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -25,8 +25,8 @@ error[E0382]: use of moved value: `a`
2525
|
2626
LL | let _x = a.x;
2727
| -- value moved here
28-
LL | //~^ value moved here
29-
LL | let _y = &a.y; //~ ERROR use of moved
28+
LL | //[ast]~^ value moved here
29+
LL | let _y = &a.y; //[ast]~ ERROR use of moved
3030
| ^^^ value used here after move
3131
|
3232
= note: move occurs because `a.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -44,7 +44,7 @@ error[E0503]: cannot use `a.y` because it was mutably borrowed
4444
|
4545
LL | let _x = &mut a.x;
4646
| --- borrow of `a.x` occurs here
47-
LL | let _y = a.y; //~ ERROR cannot use
47+
LL | let _y = a.y; //[ast]~ ERROR cannot use
4848
| ^^ use of borrowed `a.x`
4949

5050
error[E0505]: cannot move out of `a.y` because it is borrowed
@@ -60,7 +60,7 @@ error[E0502]: cannot borrow `a` (via `a.y`) as immutable because `a` is also bor
6060
|
6161
LL | let _x = &mut a.x;
6262
| --- mutable borrow occurs here (via `a.x`)
63-
LL | let _y = &a.y; //~ ERROR cannot borrow
63+
LL | let _y = &a.y; //[ast]~ ERROR cannot borrow
6464
| ^^^ immutable borrow occurs here (via `a.y`)
6565
...
6666
LL | }
@@ -71,7 +71,7 @@ error[E0502]: cannot borrow `a` (via `a.y`) as mutable because `a` is also borro
7171
|
7272
LL | let _x = &a.x;
7373
| --- immutable borrow occurs here (via `a.x`)
74-
LL | let _y = &mut a.y; //~ ERROR cannot borrow
74+
LL | let _y = &mut a.y; //[ast]~ ERROR cannot borrow
7575
| ^^^ mutable borrow occurs here (via `a.y`)
7676
...
7777
LL | }
@@ -82,8 +82,8 @@ error[E0382]: use of collaterally moved value: `a.y`
8282
|
8383
LL | let _x = a.x.x;
8484
| -- value moved here
85-
LL | //~^ value moved here
86-
LL | let _y = a.y; //~ ERROR use of collaterally moved
85+
LL | //[ast]~^ value moved here
86+
LL | let _y = a.y; //[ast]~ ERROR use of collaterally moved
8787
| ^^ value used here after move
8888
|
8989
= note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -93,8 +93,8 @@ error[E0382]: use of collaterally moved value: `a.y`
9393
|
9494
LL | let _x = a.x.x;
9595
| -- value moved here
96-
LL | //~^ value moved here
97-
LL | let _y = a.y; //~ ERROR use of collaterally moved
96+
LL | //[ast]~^ value moved here
97+
LL | let _y = a.y; //[ast]~ ERROR use of collaterally moved
9898
| ^^ value used here after move
9999
|
100100
= note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -104,8 +104,8 @@ error[E0382]: use of collaterally moved value: `a.y`
104104
|
105105
LL | let _x = a.x.x;
106106
| -- value moved here
107-
LL | //~^ value moved here
108-
LL | let _y = &a.y; //~ ERROR use of collaterally moved
107+
LL | //[ast]~^ value moved here
108+
LL | let _y = &a.y; //[ast]~ ERROR use of collaterally moved
109109
| ^^^ value used here after move
110110
|
111111
= note: move occurs because `a.x.x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
@@ -115,7 +115,7 @@ error[E0505]: cannot move out of `a.y` because it is borrowed
115115
|
116116
LL | let _x = &a.x.x;
117117
| ----- borrow of `a.x.x` occurs here
118-
LL | //~^ borrow of `a.x.x` occurs here
118+
LL | //[ast]~^ borrow of `a.x.x` occurs here
119119
LL | let _y = a.y;
120120
| ^^ move out of `a.y` occurs here
121121

@@ -124,7 +124,7 @@ error[E0503]: cannot use `a.y` because it was mutably borrowed
124124
|
125125
LL | let _x = &mut a.x.x;
126126
| ----- borrow of `a.x.x` occurs here
127-
LL | let _y = a.y; //~ ERROR cannot use
127+
LL | let _y = a.y; //[ast]~ ERROR cannot use
128128
| ^^ use of borrowed `a.x.x`
129129

130130
error[E0505]: cannot move out of `a.y` because it is borrowed
@@ -140,8 +140,8 @@ error[E0502]: cannot borrow `a.y` as immutable because `a.x.x` is also borrowed
140140
|
141141
LL | let _x = &mut a.x.x;
142142
| ----- mutable borrow occurs here
143-
LL | //~^ mutable borrow occurs here
144-
LL | let _y = &a.y; //~ ERROR cannot borrow
143+
LL | //[ast]~^ mutable borrow occurs here
144+
LL | let _y = &a.y; //[ast]~ ERROR cannot borrow
145145
| ^^^ immutable borrow occurs here
146146
...
147147
LL | }
@@ -152,8 +152,8 @@ error[E0502]: cannot borrow `a.y` as mutable because `a.x.x` is also borrowed as
152152
|
153153
LL | let _x = &a.x.x;
154154
| ----- immutable borrow occurs here
155-
LL | //~^ immutable borrow occurs here
156-
LL | let _y = &mut a.y; //~ ERROR cannot borrow
155+
LL | //[ast]~^ immutable borrow occurs here
156+
LL | let _y = &mut a.y; //[ast]~ ERROR cannot borrow
157157
| ^^^ mutable borrow occurs here
158158
...
159159
LL | }

src/test/ui/borrowck/borrowck-box-insensitivity.mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: compilation successful
22
--> $DIR/borrowck-box-insensitivity.rs:160:1
33
|
4-
LL | / fn main() {
4+
LL | / fn main() { //[mir]~ ERROR compilation successful
55
LL | | copy_after_move();
66
LL | | move_after_move();
77
LL | | borrow_after_move();

src/test/ui/borrowck/borrowck-box-insensitivity.rs

+43-43
Original file line numberDiff line numberDiff line change
@@ -33,131 +33,131 @@ 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
37-
let _y = a.y; //~ ERROR use of moved
38-
//~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
39-
//~| value used here after move
36+
//[ast]~^ value moved here
37+
let _y = a.y; //[ast]~ ERROR use of moved
38+
//[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
39+
//[ast]~| value used here after move
4040
}
4141

4242
fn move_after_move() {
4343
let a: Box<_> = box B { x: box 0, y: box 1 };
4444
let _x = a.x;
45-
//~^ value moved here
46-
let _y = a.y; //~ ERROR use of moved
47-
//~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
48-
//~| value used here after move
45+
//[ast]~^ value moved here
46+
let _y = a.y; //[ast]~ ERROR use of moved
47+
//[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
48+
//[ast]~| value used here after move
4949
}
5050

5151
fn borrow_after_move() {
5252
let a: Box<_> = box A { x: box 0, y: 1 };
5353
let _x = a.x;
54-
//~^ value moved here
55-
let _y = &a.y; //~ ERROR use of moved
56-
//~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
57-
//~| value used here after move
54+
//[ast]~^ value moved here
55+
let _y = &a.y; //[ast]~ ERROR use of moved
56+
//[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
57+
//[ast]~| value used here after move
5858
}
5959

6060
fn move_after_borrow() {
6161
let a: Box<_> = box B { x: box 0, y: box 1 };
6262
let _x = &a.x;
6363
let _y = a.y;
64-
//~^ ERROR cannot move
65-
//~| move out of
64+
//[ast]~^ ERROR cannot move
65+
//[ast]~| move out of
6666
use_imm(_x);
6767
}
6868
fn copy_after_mut_borrow() {
6969
let mut a: Box<_> = box A { x: box 0, y: 1 };
7070
let _x = &mut a.x;
71-
let _y = a.y; //~ ERROR cannot use
71+
let _y = a.y; //[ast]~ ERROR cannot use
7272
use_mut(_x);
7373
}
7474
fn move_after_mut_borrow() {
7575
let mut a: Box<_> = box B { x: box 0, y: box 1 };
7676
let _x = &mut a.x;
7777
let _y = a.y;
78-
//~^ ERROR cannot move
79-
//~| move out of
78+
//[ast]~^ ERROR cannot move
79+
//[ast]~| move out of
8080
use_mut(_x);
8181
}
8282
fn borrow_after_mut_borrow() {
8383
let mut a: Box<_> = box A { x: box 0, y: 1 };
8484
let _x = &mut a.x;
85-
let _y = &a.y; //~ ERROR cannot borrow
86-
//~^ immutable borrow occurs here (via `a.y`)
85+
let _y = &a.y; //[ast]~ ERROR cannot borrow
86+
//[ast]~^ immutable borrow occurs here (via `a.y`)
8787
use_mut(_x);
8888
}
8989
fn mut_borrow_after_borrow() {
9090
let mut a: Box<_> = box A { x: box 0, y: 1 };
9191
let _x = &a.x;
92-
let _y = &mut a.y; //~ ERROR cannot borrow
93-
//~^ mutable borrow occurs here (via `a.y`)
92+
let _y = &mut a.y; //[ast]~ ERROR cannot borrow
93+
//[ast]~^ mutable borrow occurs here (via `a.y`)
9494
use_imm(_x);
9595
}
9696
fn copy_after_move_nested() {
9797
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
9898
let _x = a.x.x;
99-
//~^ value moved here
100-
let _y = a.y; //~ ERROR use of collaterally moved
101-
//~| value used here after move
99+
//[ast]~^ value moved here
100+
let _y = a.y; //[ast]~ ERROR use of collaterally moved
101+
//[ast]~| value used here after move
102102
}
103103

104104
fn move_after_move_nested() {
105105
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
106106
let _x = a.x.x;
107-
//~^ value moved here
108-
let _y = a.y; //~ ERROR use of collaterally moved
109-
//~| value used here after move
107+
//[ast]~^ value moved here
108+
let _y = a.y; //[ast]~ ERROR use of collaterally moved
109+
//[ast]~| value used here after move
110110
}
111111

112112
fn borrow_after_move_nested() {
113113
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
114114
let _x = a.x.x;
115-
//~^ value moved here
116-
let _y = &a.y; //~ ERROR use of collaterally moved
117-
//~| value used here after move
115+
//[ast]~^ value moved here
116+
let _y = &a.y; //[ast]~ ERROR use of collaterally moved
117+
//[ast]~| value used here after move
118118
}
119119

120120
fn move_after_borrow_nested() {
121121
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
122122
let _x = &a.x.x;
123-
//~^ borrow of `a.x.x` occurs here
123+
//[ast]~^ borrow of `a.x.x` occurs here
124124
let _y = a.y;
125-
//~^ ERROR cannot move
126-
//~| move out of
125+
//[ast]~^ ERROR cannot move
126+
//[ast]~| move out of
127127
use_imm(_x);
128128
}
129129
fn copy_after_mut_borrow_nested() {
130130
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
131131
let _x = &mut a.x.x;
132-
let _y = a.y; //~ ERROR cannot use
132+
let _y = a.y; //[ast]~ ERROR cannot use
133133
use_mut(_x);
134134
}
135135
fn move_after_mut_borrow_nested() {
136136
let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
137137
let _x = &mut a.x.x;
138138
let _y = a.y;
139-
//~^ ERROR cannot move
140-
//~| move out of
139+
//[ast]~^ ERROR cannot move
140+
//[ast]~| move out of
141141
use_mut(_x);
142142
}
143143
fn borrow_after_mut_borrow_nested() {
144144
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
145145
let _x = &mut a.x.x;
146-
//~^ mutable borrow occurs here
147-
let _y = &a.y; //~ ERROR cannot borrow
148-
//~^ immutable borrow occurs here
146+
//[ast]~^ mutable borrow occurs here
147+
let _y = &a.y; //[ast]~ ERROR cannot borrow
148+
//[ast]~^ immutable borrow occurs here
149149
use_mut(_x);
150150
}
151151
fn mut_borrow_after_borrow_nested() {
152152
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
153153
let _x = &a.x.x;
154-
//~^ immutable borrow occurs here
155-
let _y = &mut a.y; //~ ERROR cannot borrow
156-
//~^ mutable borrow occurs here
154+
//[ast]~^ immutable borrow occurs here
155+
let _y = &mut a.y; //[ast]~ ERROR cannot borrow
156+
//[ast]~^ mutable borrow occurs here
157157
use_imm(_x);
158158
}
159159
#[rustc_error]
160-
fn main() {
160+
fn main() { //[mir]~ ERROR compilation successful
161161
copy_after_move();
162162
move_after_move();
163163
borrow_after_move();

0 commit comments

Comments
 (0)