Skip to content

Commit 8ffa408

Browse files
committed
Update tests for changes to cannot move errors
1 parent 9336b3d commit 8ffa408

File tree

100 files changed

+724
-1261
lines changed

Some content is hidden

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

100 files changed

+724
-1261
lines changed

src/test/ui/access-mode-in-closures.stderr

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
error[E0507]: cannot move out of borrowed content
1+
error[E0507]: cannot move out of `s.0` which is behind a shared reference
22
--> $DIR/access-mode-in-closures.rs:8:15
33
|
44
LL | match *s { S(v) => v }
5-
| ^^ - data moved here
6-
| |
7-
| cannot move out of borrowed content
5+
| ^^ -
6+
| | |
7+
| | data moved here
8+
| | move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
89
| help: consider removing the `*`: `s`
9-
|
10-
note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
11-
--> $DIR/access-mode-in-closures.rs:8:22
12-
|
13-
LL | match *s { S(v) => v }
14-
| ^
1510

1611
error: aborting due to previous error
1712

src/test/ui/binop/binop-move-semantics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ fn illegal_dereference<T: Add<Output=()>>(mut x: T, y: T) {
2727
let m = &mut x;
2828
let n = &y;
2929

30-
*m //~ ERROR: cannot move out of borrowed content
30+
*m //~ ERROR: cannot move
3131
+
32-
*n; //~ ERROR: cannot move out of borrowed content
32+
*n; //~ ERROR: cannot move
3333
use_imm(n); use_mut(m);
3434
}
3535
struct Foo;

src/test/ui/binop/binop-move-semantics.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ LL | y;
4747
LL | use_mut(n); use_imm(m);
4848
| - borrow later used here
4949

50-
error[E0507]: cannot move out of borrowed content
50+
error[E0507]: cannot move out of `*m` which is behind a mutable reference
5151
--> $DIR/binop-move-semantics.rs:30:5
5252
|
5353
LL | *m
54-
| ^^ cannot move out of borrowed content
54+
| ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait
5555

56-
error[E0507]: cannot move out of borrowed content
56+
error[E0507]: cannot move out of `*n` which is behind a shared reference
5757
--> $DIR/binop-move-semantics.rs:32:5
5858
|
5959
LL | *n;
60-
| ^^ cannot move out of borrowed content
60+
| ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait
6161

6262
error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
6363
--> $DIR/binop-move-semantics.rs:54:5

src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
error[E0507]: cannot move out of borrowed content
2-
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:17
1+
error[E0507]: cannot move out of `foo` in pattern guard
2+
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:18
33
|
44
LL | (|| { let bar = foo; bar.take() })();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
5+
| ^^ ---
6+
| | |
7+
| | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
8+
| | move occurs due to use in closure
9+
| move out of `foo` occurs here
10+
|
11+
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
612

713
error: aborting due to previous error
814

src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ fn main() {
2020
ref mut foo
2121
if {
2222
(|| { let bar = foo; bar.take() })();
23-
//[zflag]~^ ERROR cannot move out of borrowed content [E0507]
24-
//[edition]~^^ ERROR cannot move out of borrowed content [E0507]
23+
//[zflag]~^ ERROR cannot move out of `foo` in pattern guard [E0507]
24+
//[edition]~^^ ERROR cannot move out of `foo` in pattern guard [E0507]
2525
false
2626
} => {},
2727
Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),

src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
error[E0507]: cannot move out of borrowed content
2-
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:17
1+
error[E0507]: cannot move out of `foo` in pattern guard
2+
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:18
33
|
44
LL | (|| { let bar = foo; bar.take() })();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
5+
| ^^ ---
6+
| | |
7+
| | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
8+
| | move occurs due to use in closure
9+
| move out of `foo` occurs here
10+
|
11+
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
612

713
error: aborting due to previous error
814

src/test/ui/borrowck/borrowck-fn-in-const-a.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
const MOVE: fn(&String) -> String = {
55
fn broken(x: &String) -> String {
6-
return *x //~ ERROR cannot move out of borrowed content [E0507]
6+
return *x //~ ERROR cannot move
77
}
88
broken
99
};

src/test/ui/borrowck/borrowck-fn-in-const-a.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0507]: cannot move out of borrowed content
1+
error[E0507]: cannot move out of `*x` which is behind a shared reference
22
--> $DIR/borrowck-fn-in-const-a.rs:6:16
33
|
44
LL | return *x
5-
| ^^ cannot move out of borrowed content
5+
| ^^ move occurs because `*x` has type `std::string::String`, which does not implement the `Copy` trait
66

77
error: aborting due to previous error
88

src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr

+9-24
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,32 @@
1-
error[E0507]: cannot move out of borrowed content
1+
error[E0507]: cannot move out of a shared reference
22
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15
33
|
44
LL | for &a in x.iter() {
5-
| -- ^^^^^^^^ cannot move out of borrowed content
5+
| -- ^^^^^^^^
66
| ||
77
| |data moved here
8+
| |move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait
89
| help: consider removing the `&`: `a`
9-
|
10-
note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait
11-
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10
12-
|
13-
LL | for &a in x.iter() {
14-
| ^
1510

16-
error[E0507]: cannot move out of borrowed content
11+
error[E0507]: cannot move out of a shared reference
1712
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15
1813
|
1914
LL | for &a in &f.a {
20-
| -- ^^^^ cannot move out of borrowed content
15+
| -- ^^^^
2116
| ||
2217
| |data moved here
18+
| |move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
2319
| help: consider removing the `&`: `a`
24-
|
25-
note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
26-
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10
27-
|
28-
LL | for &a in &f.a {
29-
| ^
3020

31-
error[E0507]: cannot move out of borrowed content
21+
error[E0507]: cannot move out of a shared reference
3222
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
3323
|
3424
LL | for &a in x.iter() {
35-
| -- ^^^^^^^^ cannot move out of borrowed content
25+
| -- ^^^^^^^^
3626
| ||
3727
| |data moved here
28+
| |move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
3829
| help: consider removing the `&`: `a`
39-
|
40-
note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
41-
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
42-
|
43-
LL | for &a in x.iter() {
44-
| ^
4530

4631
error: aborting due to 3 previous errors
4732

src/test/ui/borrowck/borrowck-in-static.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
static FN : &'static (dyn Fn() -> (Box<dyn Fn()->Box<i32>>) + Sync) = &|| {
44
let x = Box::new(0);
5-
Box::new(|| x) //~ ERROR cannot move out of captured variable in an `Fn` closure
5+
Box::new(|| x) //~ ERROR cannot move out of `x`, a captured variable in an `Fn` closure
66
};
77

88
fn main() {

src/test/ui/borrowck/borrowck-in-static.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0507]: cannot move out of captured variable in an `Fn` closure
1+
error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure
22
--> $DIR/borrowck-in-static.rs:5:17
33
|
44
LL | let x = Box::new(0);
55
| - captured outer variable
66
LL | Box::new(|| x)
7-
| ^ cannot move out of captured variable in an `Fn` closure
7+
| ^ move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
88

99
error: aborting due to previous error
1010

src/test/ui/borrowck/borrowck-issue-2657-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0507]: cannot move out of borrowed content
1+
error[E0507]: cannot move out of `*y` which is behind a shared reference
22
--> $DIR/borrowck-issue-2657-2.rs:7:18
33
|
44
LL | let _b = *y;
55
| ^^
66
| |
7-
| cannot move out of borrowed content
7+
| move occurs because `*y` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
88
| help: consider removing the `*`: `y`
99

1010
error: aborting due to previous error

src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
warning[E0507]: cannot move out of borrowed content
2-
--> $DIR/borrowck-migrate-to-nll.rs:25:17
1+
warning[E0507]: cannot move out of `foo` in pattern guard
2+
--> $DIR/borrowck-migrate-to-nll.rs:25:18
33
|
44
LL | (|| { let bar = foo; bar.take() })();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
5+
| ^^ ---
6+
| | |
7+
| | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
8+
| | move occurs due to use in closure
9+
| move out of `foo` occurs here
610
|
11+
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
712
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
813
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
914
= note: for more information, try `rustc --explain E0729`

src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
warning[E0507]: cannot move out of borrowed content
2-
--> $DIR/borrowck-migrate-to-nll.rs:25:17
1+
warning[E0507]: cannot move out of `foo` in pattern guard
2+
--> $DIR/borrowck-migrate-to-nll.rs:25:18
33
|
44
LL | (|| { let bar = foo; bar.take() })();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
5+
| ^^ ---
6+
| | |
7+
| | move occurs because `foo` has type `&mut std::option::Option<&i32>`, which does not implement the `Copy` trait
8+
| | move occurs due to use in closure
9+
| move out of `foo` occurs here
610
|
11+
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
712
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
813
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
914
= note: for more information, try `rustc --explain E0729`

src/test/ui/borrowck/borrowck-move-by-capture.stderr

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
error[E0507]: cannot move out of captured variable in an `FnMut` closure
1+
error[E0507]: cannot move out of `bar`, a captured variable in an `FnMut` closure
22
--> $DIR/borrowck-move-by-capture.rs:9:29
33
|
44
LL | let bar: Box<_> = box 3;
55
| --- captured outer variable
66
LL | let _g = to_fn_mut(|| {
77
LL | let _h = to_fn_once(move || -> isize { *bar });
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure
8+
| ^^^^^^^^^^^^^^^^ ---
9+
| | |
10+
| | move occurs because `bar` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
11+
| | move occurs due to use in closure
12+
| move out of `bar` occurs here
913

1014
error: aborting due to previous error
1115

src/test/ui/borrowck/borrowck-move-error-with-note.rs

-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ enum Foo {
99
fn blah() {
1010
let f = &Foo::Foo1(box 1, box 2);
1111
match *f { //~ ERROR cannot move out of
12-
//~| cannot move out
1312
Foo::Foo1(num1,
1413
num2) => (),
1514
Foo::Foo2(num) => (),
@@ -28,7 +27,6 @@ impl Drop for S {
2827
fn move_in_match() {
2928
match (S {f: "foo".to_string(), g: "bar".to_string()}) {
3029
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
31-
//~| cannot move out of here
3230
S {
3331
f: _s,
3432
g: _t
@@ -46,7 +44,6 @@ fn free<T>(_: T) {}
4644
fn blah2() {
4745
let a = &A { a: box 1 };
4846
match a.a { //~ ERROR cannot move out of
49-
//~| cannot move out
5047
n => {
5148
free(n)
5249
}

src/test/ui/borrowck/borrowck-move-error-with-note.stderr

+12-23
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
error[E0507]: cannot move out of borrowed content
1+
error[E0507]: cannot move out of `f.0` which is behind a shared reference
22
--> $DIR/borrowck-move-error-with-note.rs:11:11
33
|
44
LL | match *f {
5-
| ^^
6-
| |
7-
| cannot move out of borrowed content
8-
| help: consider removing the `*`: `f`
9-
LL |
5+
| ^^ help: consider removing the `*`: `f`
106
LL | Foo::Foo1(num1,
117
| ---- data moved here
128
LL | num2) => (),
@@ -15,7 +11,7 @@ LL | Foo::Foo2(num) => (),
1511
| --- ...and here
1612
|
1713
note: move occurs because these variables have types that don't implement the `Copy` trait
18-
--> $DIR/borrowck-move-error-with-note.rs:13:19
14+
--> $DIR/borrowck-move-error-with-note.rs:12:19
1915
|
2016
LL | Foo::Foo1(num1,
2117
| ^^^^
@@ -25,7 +21,7 @@ LL | Foo::Foo2(num) => (),
2521
| ^^^
2622

2723
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
28-
--> $DIR/borrowck-move-error-with-note.rs:29:11
24+
--> $DIR/borrowck-move-error-with-note.rs:28:11
2925
|
3026
LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) {
3127
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
@@ -36,30 +32,23 @@ LL | g: _t
3632
| -- ...and here
3733
|
3834
note: move occurs because these variables have types that don't implement the `Copy` trait
39-
--> $DIR/borrowck-move-error-with-note.rs:33:16
35+
--> $DIR/borrowck-move-error-with-note.rs:31:16
4036
|
4137
LL | f: _s,
4238
| ^^
4339
LL | g: _t
4440
| ^^
4541

46-
error[E0507]: cannot move out of borrowed content
47-
--> $DIR/borrowck-move-error-with-note.rs:48:11
42+
error[E0507]: cannot move out of `a.a` which is behind a shared reference
43+
--> $DIR/borrowck-move-error-with-note.rs:46:11
4844
|
4945
LL | match a.a {
50-
| ^^^
51-
| |
52-
| cannot move out of borrowed content
53-
| help: consider borrowing here: `&a.a`
54-
LL |
46+
| ^^^ help: consider borrowing here: `&a.a`
5547
LL | n => {
56-
| - data moved here
57-
|
58-
note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
59-
--> $DIR/borrowck-move-error-with-note.rs:50:9
60-
|
61-
LL | n => {
62-
| ^
48+
| -
49+
| |
50+
| data moved here
51+
| move occurs because `n` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
6352

6453
error: aborting due to 3 previous errors
6554

src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
unsafe fn foo(x: *const Box<isize>) -> Box<isize> {
2-
let y = *x; //~ ERROR cannot move out of dereference of raw pointer
2+
let y = *x; //~ ERROR cannot move out of `*x` which is behind a raw pointer
33
return y;
44
}
55

src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0507]: cannot move out of dereference of raw pointer
1+
error[E0507]: cannot move out of `*x` which is behind a raw pointer
22
--> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13
33
|
44
LL | let y = *x;
55
| ^^
66
| |
7-
| cannot move out of dereference of raw pointer
7+
| move occurs because `*x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
88
| help: consider removing the `*`: `x`
99

1010
error: aborting due to previous error

0 commit comments

Comments
 (0)