Fix the expected error annotations.
(The commit prior to this actual passes our test suite, "thanks" to #55695. But since I am aware of that bug, I took advantage of it in choosing how to order my commit series...)
This commit is contained in:
parent
d0151cac17
commit
9b6a568c6f
@ -3,8 +3,8 @@ error[E0382]: use of moved value: `a`
|
||||
|
|
||||
LL | let _x = a.x;
|
||||
| -- value moved here
|
||||
LL | //~^ value moved here
|
||||
LL | let _y = a.y; //~ ERROR use of moved
|
||||
LL | //[ast]~^ value moved here
|
||||
LL | let _y = a.y; //[ast]~ ERROR use of moved
|
||||
| ^^ value used here after move
|
||||
|
|
||||
= 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`
|
||||
|
|
||||
LL | let _x = a.x;
|
||||
| -- value moved here
|
||||
LL | //~^ value moved here
|
||||
LL | let _y = a.y; //~ ERROR use of moved
|
||||
LL | //[ast]~^ value moved here
|
||||
LL | let _y = a.y; //[ast]~ ERROR use of moved
|
||||
| ^^ value used here after move
|
||||
|
|
||||
= 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`
|
||||
|
|
||||
LL | let _x = a.x;
|
||||
| -- value moved here
|
||||
LL | //~^ value moved here
|
||||
LL | let _y = &a.y; //~ ERROR use of moved
|
||||
LL | //[ast]~^ value moved here
|
||||
LL | let _y = &a.y; //[ast]~ ERROR use of moved
|
||||
| ^^^ value used here after move
|
||||
|
|
||||
= 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
|
||||
|
|
||||
LL | let _x = &mut a.x;
|
||||
| --- borrow of `a.x` occurs here
|
||||
LL | let _y = a.y; //~ ERROR cannot use
|
||||
LL | let _y = a.y; //[ast]~ ERROR cannot use
|
||||
| ^^ use of borrowed `a.x`
|
||||
|
||||
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
|
||||
|
|
||||
LL | let _x = &mut a.x;
|
||||
| --- mutable borrow occurs here (via `a.x`)
|
||||
LL | let _y = &a.y; //~ ERROR cannot borrow
|
||||
LL | let _y = &a.y; //[ast]~ ERROR cannot borrow
|
||||
| ^^^ immutable borrow occurs here (via `a.y`)
|
||||
...
|
||||
LL | }
|
||||
@ -71,7 +71,7 @@ error[E0502]: cannot borrow `a` (via `a.y`) as mutable because `a` is also borro
|
||||
|
|
||||
LL | let _x = &a.x;
|
||||
| --- immutable borrow occurs here (via `a.x`)
|
||||
LL | let _y = &mut a.y; //~ ERROR cannot borrow
|
||||
LL | let _y = &mut a.y; //[ast]~ ERROR cannot borrow
|
||||
| ^^^ mutable borrow occurs here (via `a.y`)
|
||||
...
|
||||
LL | }
|
||||
@ -82,8 +82,8 @@ error[E0382]: use of collaterally moved value: `a.y`
|
||||
|
|
||||
LL | let _x = a.x.x;
|
||||
| -- value moved here
|
||||
LL | //~^ value moved here
|
||||
LL | let _y = a.y; //~ ERROR use of collaterally moved
|
||||
LL | //[ast]~^ value moved here
|
||||
LL | let _y = a.y; //[ast]~ ERROR use of collaterally moved
|
||||
| ^^ value used here after move
|
||||
|
|
||||
= 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`
|
||||
|
|
||||
LL | let _x = a.x.x;
|
||||
| -- value moved here
|
||||
LL | //~^ value moved here
|
||||
LL | let _y = a.y; //~ ERROR use of collaterally moved
|
||||
LL | //[ast]~^ value moved here
|
||||
LL | let _y = a.y; //[ast]~ ERROR use of collaterally moved
|
||||
| ^^ value used here after move
|
||||
|
|
||||
= 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`
|
||||
|
|
||||
LL | let _x = a.x.x;
|
||||
| -- value moved here
|
||||
LL | //~^ value moved here
|
||||
LL | let _y = &a.y; //~ ERROR use of collaterally moved
|
||||
LL | //[ast]~^ value moved here
|
||||
LL | let _y = &a.y; //[ast]~ ERROR use of collaterally moved
|
||||
| ^^^ value used here after move
|
||||
|
|
||||
= 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
|
||||
|
|
||||
LL | let _x = &a.x.x;
|
||||
| ----- borrow of `a.x.x` occurs here
|
||||
LL | //~^ borrow of `a.x.x` occurs here
|
||||
LL | //[ast]~^ borrow of `a.x.x` occurs here
|
||||
LL | let _y = a.y;
|
||||
| ^^ move out of `a.y` occurs here
|
||||
|
||||
@ -124,7 +124,7 @@ error[E0503]: cannot use `a.y` because it was mutably borrowed
|
||||
|
|
||||
LL | let _x = &mut a.x.x;
|
||||
| ----- borrow of `a.x.x` occurs here
|
||||
LL | let _y = a.y; //~ ERROR cannot use
|
||||
LL | let _y = a.y; //[ast]~ ERROR cannot use
|
||||
| ^^ use of borrowed `a.x.x`
|
||||
|
||||
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
|
||||
|
|
||||
LL | let _x = &mut a.x.x;
|
||||
| ----- mutable borrow occurs here
|
||||
LL | //~^ mutable borrow occurs here
|
||||
LL | let _y = &a.y; //~ ERROR cannot borrow
|
||||
LL | //[ast]~^ mutable borrow occurs here
|
||||
LL | let _y = &a.y; //[ast]~ ERROR cannot borrow
|
||||
| ^^^ immutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
@ -152,8 +152,8 @@ error[E0502]: cannot borrow `a.y` as mutable because `a.x.x` is also borrowed as
|
||||
|
|
||||
LL | let _x = &a.x.x;
|
||||
| ----- immutable borrow occurs here
|
||||
LL | //~^ immutable borrow occurs here
|
||||
LL | let _y = &mut a.y; //~ ERROR cannot borrow
|
||||
LL | //[ast]~^ immutable borrow occurs here
|
||||
LL | let _y = &mut a.y; //[ast]~ ERROR cannot borrow
|
||||
| ^^^ mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
|
@ -1,7 +1,7 @@
|
||||
error: compilation successful
|
||||
--> $DIR/borrowck-box-insensitivity.rs:160:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | / fn main() { //[mir]~ ERROR compilation successful
|
||||
LL | | copy_after_move();
|
||||
LL | | move_after_move();
|
||||
LL | | borrow_after_move();
|
||||
|
@ -33,131 +33,131 @@ struct D {
|
||||
fn copy_after_move() {
|
||||
let a: Box<_> = box A { x: box 0, y: 1 };
|
||||
let _x = a.x;
|
||||
//~^ value moved here
|
||||
let _y = a.y; //~ ERROR use of moved
|
||||
//~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
|
||||
//~| value used here after move
|
||||
//[ast]~^ value moved here
|
||||
let _y = a.y; //[ast]~ ERROR use of moved
|
||||
//[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
|
||||
//[ast]~| value used here after move
|
||||
}
|
||||
|
||||
fn move_after_move() {
|
||||
let a: Box<_> = box B { x: box 0, y: box 1 };
|
||||
let _x = a.x;
|
||||
//~^ value moved here
|
||||
let _y = a.y; //~ ERROR use of moved
|
||||
//~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
|
||||
//~| value used here after move
|
||||
//[ast]~^ value moved here
|
||||
let _y = a.y; //[ast]~ ERROR use of moved
|
||||
//[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
|
||||
//[ast]~| value used here after move
|
||||
}
|
||||
|
||||
fn borrow_after_move() {
|
||||
let a: Box<_> = box A { x: box 0, y: 1 };
|
||||
let _x = a.x;
|
||||
//~^ value moved here
|
||||
let _y = &a.y; //~ ERROR use of moved
|
||||
//~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
|
||||
//~| value used here after move
|
||||
//[ast]~^ value moved here
|
||||
let _y = &a.y; //[ast]~ ERROR use of moved
|
||||
//[ast]~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
|
||||
//[ast]~| value used here after move
|
||||
}
|
||||
|
||||
fn move_after_borrow() {
|
||||
let a: Box<_> = box B { x: box 0, y: box 1 };
|
||||
let _x = &a.x;
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
//[ast]~^ ERROR cannot move
|
||||
//[ast]~| move out of
|
||||
use_imm(_x);
|
||||
}
|
||||
fn copy_after_mut_borrow() {
|
||||
let mut a: Box<_> = box A { x: box 0, y: 1 };
|
||||
let _x = &mut a.x;
|
||||
let _y = a.y; //~ ERROR cannot use
|
||||
let _y = a.y; //[ast]~ ERROR cannot use
|
||||
use_mut(_x);
|
||||
}
|
||||
fn move_after_mut_borrow() {
|
||||
let mut a: Box<_> = box B { x: box 0, y: box 1 };
|
||||
let _x = &mut a.x;
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
//[ast]~^ ERROR cannot move
|
||||
//[ast]~| move out of
|
||||
use_mut(_x);
|
||||
}
|
||||
fn borrow_after_mut_borrow() {
|
||||
let mut a: Box<_> = box A { x: box 0, y: 1 };
|
||||
let _x = &mut a.x;
|
||||
let _y = &a.y; //~ ERROR cannot borrow
|
||||
//~^ immutable borrow occurs here (via `a.y`)
|
||||
let _y = &a.y; //[ast]~ ERROR cannot borrow
|
||||
//[ast]~^ immutable borrow occurs here (via `a.y`)
|
||||
use_mut(_x);
|
||||
}
|
||||
fn mut_borrow_after_borrow() {
|
||||
let mut a: Box<_> = box A { x: box 0, y: 1 };
|
||||
let _x = &a.x;
|
||||
let _y = &mut a.y; //~ ERROR cannot borrow
|
||||
//~^ mutable borrow occurs here (via `a.y`)
|
||||
let _y = &mut a.y; //[ast]~ ERROR cannot borrow
|
||||
//[ast]~^ mutable borrow occurs here (via `a.y`)
|
||||
use_imm(_x);
|
||||
}
|
||||
fn copy_after_move_nested() {
|
||||
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
|
||||
let _x = a.x.x;
|
||||
//~^ value moved here
|
||||
let _y = a.y; //~ ERROR use of collaterally moved
|
||||
//~| value used here after move
|
||||
//[ast]~^ value moved here
|
||||
let _y = a.y; //[ast]~ ERROR use of collaterally moved
|
||||
//[ast]~| value used here after move
|
||||
}
|
||||
|
||||
fn move_after_move_nested() {
|
||||
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
|
||||
let _x = a.x.x;
|
||||
//~^ value moved here
|
||||
let _y = a.y; //~ ERROR use of collaterally moved
|
||||
//~| value used here after move
|
||||
//[ast]~^ value moved here
|
||||
let _y = a.y; //[ast]~ ERROR use of collaterally moved
|
||||
//[ast]~| value used here after move
|
||||
}
|
||||
|
||||
fn borrow_after_move_nested() {
|
||||
let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
|
||||
let _x = a.x.x;
|
||||
//~^ value moved here
|
||||
let _y = &a.y; //~ ERROR use of collaterally moved
|
||||
//~| value used here after move
|
||||
//[ast]~^ value moved here
|
||||
let _y = &a.y; //[ast]~ ERROR use of collaterally moved
|
||||
//[ast]~| value used here after move
|
||||
}
|
||||
|
||||
fn move_after_borrow_nested() {
|
||||
let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
|
||||
let _x = &a.x.x;
|
||||
//~^ borrow of `a.x.x` occurs here
|
||||
//[ast]~^ borrow of `a.x.x` occurs here
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
//[ast]~^ ERROR cannot move
|
||||
//[ast]~| move out of
|
||||
use_imm(_x);
|
||||
}
|
||||
fn copy_after_mut_borrow_nested() {
|
||||
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
|
||||
let _x = &mut a.x.x;
|
||||
let _y = a.y; //~ ERROR cannot use
|
||||
let _y = a.y; //[ast]~ ERROR cannot use
|
||||
use_mut(_x);
|
||||
}
|
||||
fn move_after_mut_borrow_nested() {
|
||||
let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 };
|
||||
let _x = &mut a.x.x;
|
||||
let _y = a.y;
|
||||
//~^ ERROR cannot move
|
||||
//~| move out of
|
||||
//[ast]~^ ERROR cannot move
|
||||
//[ast]~| move out of
|
||||
use_mut(_x);
|
||||
}
|
||||
fn borrow_after_mut_borrow_nested() {
|
||||
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
|
||||
let _x = &mut a.x.x;
|
||||
//~^ mutable borrow occurs here
|
||||
let _y = &a.y; //~ ERROR cannot borrow
|
||||
//~^ immutable borrow occurs here
|
||||
//[ast]~^ mutable borrow occurs here
|
||||
let _y = &a.y; //[ast]~ ERROR cannot borrow
|
||||
//[ast]~^ immutable borrow occurs here
|
||||
use_mut(_x);
|
||||
}
|
||||
fn mut_borrow_after_borrow_nested() {
|
||||
let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 };
|
||||
let _x = &a.x.x;
|
||||
//~^ immutable borrow occurs here
|
||||
let _y = &mut a.y; //~ ERROR cannot borrow
|
||||
//~^ mutable borrow occurs here
|
||||
//[ast]~^ immutable borrow occurs here
|
||||
let _y = &mut a.y; //[ast]~ ERROR cannot borrow
|
||||
//[ast]~^ mutable borrow occurs here
|
||||
use_imm(_x);
|
||||
}
|
||||
#[rustc_error]
|
||||
fn main() {
|
||||
fn main() { //[mir]~ ERROR compilation successful
|
||||
copy_after_move();
|
||||
move_after_move();
|
||||
borrow_after_move();
|
||||
|
Loading…
x
Reference in New Issue
Block a user