Skip to content

Commit

Permalink
Fix the expected error annotations.
Browse files Browse the repository at this point in the history
(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...)
  • Loading branch information
pnkfelix committed Nov 8, 2018
1 parent d0151ca commit 9b6a568
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 65 deletions.
42 changes: 21 additions & 21 deletions src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 | }
Expand All @@ -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 | }
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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 | }
Expand All @@ -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 | }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-box-insensitivity.mir.stderr
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
86 changes: 43 additions & 43 deletions src/test/ui/borrowck/borrowck-box-insensitivity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9b6a568

Please sign in to comment.