Skip to content

Commit 48de0ff

Browse files
committed
add non-copy note to stderr
1 parent 8d77c7c commit 48de0ff

20 files changed

+62
-45
lines changed

Diff for: src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ LL | v[0].y;
316316
LL | drop(x);
317317
| - borrow later used here
318318

319-
error[E0503]: cannot use `v[..].y` because it was mutably borrowed
319+
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
320320
--> $DIR/borrowck-describe-lvalue.rs:261:9
321321
|
322322
LL | let x = &mut v;

Diff for: src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ LL | v[0].y;
316316
LL | drop(x);
317317
| - borrow later used here
318318

319-
error[E0503]: cannot use `v[..].y` because it was mutably borrowed
319+
error[E0503]: cannot use `v[_].y` because it was mutably borrowed
320320
--> $DIR/borrowck-describe-lvalue.rs:261:9
321321
|
322322
LL | let x = &mut v;

Diff for: src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | drop(x.b);
55
| --- value moved here
66
LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
77
| ^^^^ value used here after move
8+
|
9+
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
810

911
error[E0382]: use of moved value: `x.b`
1012
--> $DIR/borrowck-field-sensitivity.rs:14:10
@@ -13,6 +15,8 @@ LL | let y = A { a: 3, .. x };
1315
| ---------------- value moved here
1416
LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
1517
| ^^^^ value used here after move
18+
|
19+
= note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
1620

1721
error[E0382]: borrow of moved value: `x.b`
1822
--> $DIR/borrowck-field-sensitivity.rs:20:13

Diff for: src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr

-19
This file was deleted.

Diff for: src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | let [_, _x] = a;
55
| -- value moved here
66
LL | let [.., _y] = a; //[ast]~ ERROR [E0382]
77
| ^^ value used here after move
8+
|
9+
= note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
810

911
error[E0382]: use of moved value: `a[..]`
1012
--> $DIR/borrowck-move-out-from-array.rs:17:10
@@ -13,6 +15,8 @@ LL | let [_x, _] = a;
1315
| -- value moved here
1416
LL | let [_y..] = a; //[ast]~ ERROR [E0382]
1517
| ^^ value used here after move
18+
|
19+
= note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
1620

1721
error: aborting due to 2 previous errors
1822

Diff for: src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0506]: cannot assign to `a[..]` because it is borrowed
1+
error[E0506]: cannot assign to `a[_]` because it is borrowed
22
--> $DIR/borrowck-vec-pattern-move-tail.rs:16:5
33
|
44
LL | [1, 2, ref tail..] => tail,
5-
| -------- borrow of `a[..]` occurs here
5+
| -------- borrow of `a[_]` occurs here
66
...
77
LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
8-
| ^^^^^^^^ assignment to borrowed `a[..]` occurs here
8+
| ^^^^^^^^ assignment to borrowed `a[_]` occurs here
99
...
1010
LL | println!("t[0]: {}", t[0]);
1111
| ---- borrow later used here

Diff for: src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ LL | [1, 2, ref tail..] => tail,
77
LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
88
| ^^^^^^^^ assignment to borrowed `a[..]` occurs here
99

10-
error[E0506]: cannot assign to `a[..]` because it is borrowed (Mir)
10+
error[E0506]: cannot assign to `a[_]` because it is borrowed (Mir)
1111
--> $DIR/borrowck-vec-pattern-move-tail.rs:16:5
1212
|
1313
LL | [1, 2, ref tail..] => tail,
14-
| -------- borrow of `a[..]` occurs here
14+
| -------- borrow of `a[_]` occurs here
1515
...
1616
LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
17-
| ^^^^^^^^ assignment to borrowed `a[..]` occurs here
17+
| ^^^^^^^^ assignment to borrowed `a[_]` occurs here
1818
...
1919
LL | println!("t[0]: {}", t[0]);
2020
| ---- borrow later used here

Diff for: src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
error[E0506]: cannot assign to `vec[..]` because it is borrowed
1+
error[E0506]: cannot assign to `vec[_]` because it is borrowed
22
--> $DIR/borrowck-vec-pattern-nesting.rs:10:13
33
|
44
LL | [box ref _a, _, _] => {
5-
| ------ borrow of `vec[..]` occurs here
5+
| ------ borrow of `vec[_]` occurs here
66
LL | //~^ borrow of `vec[..]` occurs here
77
LL | vec[0] = box 4; //~ ERROR cannot assign
8-
| ^^^^^^ assignment to borrowed `vec[..]` occurs here
8+
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
99
LL | //~^ assignment to borrowed `vec[..]` occurs here
1010
LL | _a.use_ref();
1111
| -- borrow later used here
1212

13-
error[E0506]: cannot assign to `vec[..]` because it is borrowed
13+
error[E0506]: cannot assign to `vec[_]` because it is borrowed
1414
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13
1515
|
1616
LL | &mut [ref _b..] => {
17-
| ------ borrow of `vec[..]` occurs here
17+
| ------ borrow of `vec[_]` occurs here
1818
LL | //~^ borrow of `vec[..]` occurs here
1919
LL | vec[0] = box 4; //~ ERROR cannot assign
20-
| ^^^^^^ assignment to borrowed `vec[..]` occurs here
20+
| ^^^^^^ assignment to borrowed `vec[_]` occurs here
2121
LL | //~^ assignment to borrowed `vec[..]` occurs here
2222
LL | _b.use_ref();
2323
| -- borrow later used here

Diff for: src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ LL | f(f(10));
1414
| - ^ value used here after move
1515
| |
1616
| value moved here
17+
|
18+
= note: move occurs because `*f` has type `F`, which does not implement the `Copy` trait
1719

1820
error[E0499]: cannot borrow `*f` as mutable more than once at a time
1921
--> $DIR/two-phase-nonrecv-autoref.rs:76:11
@@ -43,6 +45,8 @@ LL | f(f(10));
4345
| - ^ value used here after move
4446
| |
4547
| value moved here
48+
|
49+
= note: move occurs because `*f` has type `dyn std::ops::FnOnce(i32) -> i32`, which does not implement the `Copy` trait
4650

4751
error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
4852
--> $DIR/two-phase-nonrecv-autoref.rs:129:27

Diff for: src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ LL | f(f(10));
1414
| - ^ value used here after move
1515
| |
1616
| value moved here
17+
|
18+
= note: move occurs because `*f` has type `F`, which does not implement the `Copy` trait
1719

1820
error[E0499]: cannot borrow `*f` as mutable more than once at a time
1921
--> $DIR/two-phase-nonrecv-autoref.rs:76:11
@@ -43,6 +45,8 @@ LL | f(f(10));
4345
| - ^ value used here after move
4446
| |
4547
| value moved here
48+
|
49+
= note: move occurs because `*f` has type `dyn std::ops::FnOnce(i32) -> i32`, which does not implement the `Copy` trait
4650

4751
error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
4852
--> $DIR/two-phase-nonrecv-autoref.rs:129:27

Diff for: src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ LL | _ if { (|| { let bar = b; *bar = false; })();
88
LL | false } => { },
99
LL | &mut true => { println!("You might think we should get here"); },
1010
| ^^^^ value used here after move
11+
|
12+
= note: move occurs because `b` has type `&mut bool`, which does not implement the `Copy` trait
1113

1214
error: aborting due to previous error
1315

Diff for: src/test/ui/issues/issue-42344.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0596]: cannot borrow `*TAB[..]` as mutable, as `TAB` is an immutable static item
1+
error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item
22
--> $DIR/issue-42344.rs:4:5
33
|
44
LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389]

Diff for: src/test/ui/issues/issue-46604.ast.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0017]: references in statics may only refer to immutable values
44
LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
55
| ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
66

7-
error[E0594]: cannot assign to `buf[..]`, as `buf` is an immutable static item
7+
error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
88
--> $DIR/issue-46604.rs:10:5
99
|
1010
LL | buf[0]=2; //[ast]~ ERROR E0389

Diff for: src/test/ui/issues/issue-46604.mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0017]: references in statics may only refer to immutable values
44
LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
55
| ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
66

7-
error[E0594]: cannot assign to `buf[..]`, as `buf` is an immutable static item
7+
error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item
88
--> $DIR/issue-46604.rs:10:5
99
|
1010
LL | buf[0]=2; //[ast]~ ERROR E0389

Diff for: src/test/ui/liveness/liveness-use-after-move.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | let y = x;
55
| - value moved here
66
LL | println!("{}", *x); //~ ERROR use of moved value: `*x`
77
| ^^ value borrowed here after move
8+
|
9+
= note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
810

911
error: aborting due to previous error
1012

Diff for: src/test/ui/nll/drop-no-may-dangle.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
error[E0506]: cannot assign to `v[..]` because it is borrowed
1+
error[E0506]: cannot assign to `v[_]` because it is borrowed
22
--> $DIR/drop-no-may-dangle.rs:20:9
33
|
44
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
5-
| ----- borrow of `v[..]` occurs here
5+
| ----- borrow of `v[_]` occurs here
66
...
7-
LL | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed
8-
| ^^^^^^^^^ assignment to borrowed `v[..]` occurs here
7+
LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed
8+
| ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
99
...
1010
LL | }
1111
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
1212

13-
error[E0506]: cannot assign to `v[..]` because it is borrowed
13+
error[E0506]: cannot assign to `v[_]` because it is borrowed
1414
--> $DIR/drop-no-may-dangle.rs:23:5
1515
|
1616
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
17-
| ----- borrow of `v[..]` occurs here
17+
| ----- borrow of `v[_]` occurs here
1818
...
19-
LL | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed
20-
| ^^^^^^^^^ assignment to borrowed `v[..]` occurs here
19+
LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed
20+
| ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
2121
LL | }
2222
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
2323

Diff for: src/test/ui/unsized-locals/borrow-after-move.nll.stderr

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | let y = *x;
66
LL | drop_unsized(y);
77
LL | println!("{}", &x);
88
| ^^ value borrowed here after move
9+
|
10+
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
911

1012
error[E0382]: borrow of moved value: `y`
1113
--> $DIR/borrow-after-move.rs:22:24
@@ -26,6 +28,8 @@ LL | let y = *x;
2628
LL | y.foo();
2729
LL | println!("{}", &x);
2830
| ^^ value borrowed here after move
31+
|
32+
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
2933

3034
error[E0382]: borrow of moved value: `y`
3135
--> $DIR/borrow-after-move.rs:32:24
@@ -45,6 +49,8 @@ LL | x.foo();
4549
| - value moved here
4650
LL | println!("{}", &x);
4751
| ^^ value borrowed here after move
52+
|
53+
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
4854

4955
error: aborting due to 5 previous errors
5056

Diff for: src/test/ui/unsized-locals/double-move.nll.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ LL | let _y = *x;
1515
| -- value moved here
1616
LL | drop_unsized(x); //~ERROR use of moved value
1717
| ^ value used here after move
18+
|
19+
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
1820

1921
error[E0382]: use of moved value: `*x`
2022
--> $DIR/double-move.rs:32:18
@@ -23,6 +25,8 @@ LL | drop_unsized(x);
2325
| - value moved here
2426
LL | let _y = *x; //~ERROR use of moved value
2527
| ^^ value used here after move
28+
|
29+
= note: move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
2630

2731
error[E0382]: use of moved value: `y`
2832
--> $DIR/double-move.rs:39:9
@@ -41,6 +45,8 @@ LL | let _y = *x;
4145
| -- value moved here
4246
LL | x.foo(); //~ERROR use of moved value
4347
| ^ value used here after move
48+
|
49+
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
4450

4551
error[E0382]: use of moved value: `*x`
4652
--> $DIR/double-move.rs:51:18
@@ -49,6 +55,8 @@ LL | x.foo();
4955
| - value moved here
5056
LL | let _y = *x; //~ERROR use of moved value
5157
| ^^ value used here after move
58+
|
59+
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
5260

5361
error: aborting due to 6 previous errors
5462

Diff for: src/test/ui/use/use-after-move-self.nll.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | self.bar();
55
| ---- value moved here
66
LL | return *self.x; //~ ERROR use of moved value: `*self.x`
77
| ^^^^^^^ value used here after move
8+
|
9+
= note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
810

911
error: aborting due to previous error
1012

Diff for: src/test/ui/use/use-after-move-self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct S {
77
impl S {
88
pub fn foo(self) -> isize {
99
self.bar();
10-
return *self.x; //~ ERROR use of moved value: `self`
10+
return *self.x; //~ ERROR use of moved value: `*self.x`
1111
}
1212

1313
pub fn bar(self) {}

0 commit comments

Comments
 (0)